We build. You grow.

Get best community software here

Start a social network, a fan-site, an education project with oxwall - free opensource community software

Weird problem... | Forum

Sean
Sean Jun 18 '14
I'm creating a new plugin, and have the following code in one controller:


public function __construct()

{

//Services

$this->language = OW::getLanguage();

$this->service = OFLOTTERY_BOL_Service::getInstance();

$this->router = OW::getRouter();

$this->feedback = OW::getFeedback();

$this->creditService = OFCREDITSERVICE_BOL_Service::getInstance();


//Variables

$this->userId = OW::getUser()->getId();

$this->pKey = 'oflottery';

}


This works fine.


I have the exact same code in a BOL Service file, but I keep getting an error saying that 'OFCREDITSERVICE_BOL_Service::getInstance(); cannot be found'.


How can it not be found when my other plugins reference this, and the controller for this plugin does too?


Any ideas?

The Forum post is edited by Sean Jun 18 '14
Arash
Arash Jun 18 '14
I'm guseeing you have the:


     public static function getInstance()        {            if ( self::$classInstance === null )            {                self::$classInstance = new self();            }
            return self::$classInstance;        }

in the service file as well?

Sean
Sean Jun 18 '14
I do indeed, this is really baffling me, as I'm referencing other services as well, and it has no issue with them, it's just this one! Humm
Sean
Sean Jun 22 '14
Oddly, if I call this as a variable within a function, rather than setting it in the construct it works, and finds the service correctly...