XF 2.0 Extending Service Class - How to access User Options?

BoostN

Well-known member
I seem to be doing something stupid. I'm extending the XF\Service\User class with my add-on.. I'm just trying to get the value like so:

PHP:
<?php

namespace BoostN\SendySync\XF\Service\User;


class Welcome extends XFCP_Welcome
{
    public function send(){

        $user = $this->user;

        $value = $user->Option->receive_admin_email;
        //DO SOMETHING
        parent::send();
    }
}

Is this the improper way to access the user options entity within my extended class? PHPStorm seems to say the object is there... but, I get nothing.
 
For whatever reason, if the value is 0 in the DB, it doesn't return the correct value in the log. I can manually change the DB value to "1" and it actually returns a 1 when I dump the variable. For some reason it doesn't dump 0 /false.

My entity structure as a default value of "False", not sure why the \XF::dump(var) returns empty for a 0 value in the DB.
 

Attachments

  • 1542759026823.webp
    1542759026823.webp
    32.4 KB · Views: 14
Top Bottom