I have a class called class Settings in Settings.php
class Settings
{ public function UserRole($is_login = false){
$default = ['id' => 1, 'name' => 'New user'];
$user_role = $this->getUser($id);
if( !$user_role )
return $default;
else ... etc.}
}
The problem is, in my User.php, where I have this:
use Settings;
class Helper_User extends \Zend_View_Helper_Abstract
{
public function mainNavigation($is_collapsed = false){
$instance = Zend_Controller_Front::getInstance();
...
return $this->container();
}
public function container(){
$newuser = $this->getNewUser();
$html = "blabla";
return $html;
}
}
and anywhere I try to put this $role = $this->Settings->UserRole();
I have this error
Uncaught Error: Call to a member function UserRole() on null.
Can you please help what is wrong here? Thanks.