Hi there,
I have some models witch are using Doctrine nestedset feature. I want to add delete functionaly of elements from tree since that is required in my application. I was trying with snippets from documentation but I am getting a very strange error with that code.
YAML is here: http://pastie.org/820978
And I am trying with this code in my Menu class witch extends generated abstract class BaseMenu and BaseMenu extends Doctrine_Record :)
Anyway my code:
public function getMenuItem($id)
{
return Doctrine::getTable('Menu')->find($id);
}
public function delete($id)
{
$item = $this->getMenuItem($id);
//echo get_class($item); will return Menu so object exists !?
$item->getNode()->delete();
}
And I get this an error:
Fatal error: Call to a member function getNode() on a non-object
And I just noticed that get_class($item) is trowing a warring (so that probabbly is reason for this strange behavior):
Warning: get_class() expects parameter 1 to be object, boolean given in...
However I need a solution for this and all hints are welcome...