I get this error when I try to use a model:
fatal error: Call to a member function getSubMenu() on a non-object in /workcedric2/bambinbazar/apps/frontend/modules/categories/actions/components.class.php on line 25
I tried clearing the cache with symfony cc and rebuilding the model… no go.
The component:
public function executeSubmenu(sfWebRequest $request)
{
$currentCatId = $this->getVar('currentCatId');
$currentId = $this->getVar('currentId');
$this->subCategories = $this->bambinbazar_category->getSubMenu($currentCatId);
}
The model in file BambinbazarCategory.class.php:
public function getSubMenu($currentCatId)
{
$q = Doctrine_Core::getTable('BambinbazarCategory')->createQuery('tree')
->where('tree.parent_id = ?', $currentCatId )
->addOrderBy('tree.parent_id ASC')
->addOrderBy('tree.lft ASC')
->execute();
return $q;
}
Well, apparently your
$this->bambinbazar_categoryis null or not an object.executeSubmenudoesn’t set that variable, probably it is set somewhere outside, so check the code that sets it and make sure that it’s not null.Or you can just add a check before you try to call
getSubMenu