Skip to main content

Call to a member function someting() on bool

This message is telling you that the function/method you called named something is not available because the object that contains that function has not been created. The boolean, false or true,  indicates that the object doesn't exist, but there is no clue as to why it was not created or even which class holds the function. You need to find the class that contains the function/method  was supposed to be instantiated and then determine why the object of that class was not created.

A simple example to show what should be happening

   $model      = BaseDatabaseModel::getInstance('Fred', 'FredModel');
   $results    = $model->something();

However if the first line fails to create the $model object then the second line will produce the error because $model does not exist, or is false in boolean terms, and thus something() also does not exist.

Working with the User object

Contains various approaches and examples of how to work with the User object in your code like getting the current User and create a new User object.