Depending on the impl., just checking for existence could be cheaper than loading. But if having automatically means we will load anyways, indeed we save nothing. Without the Type check, we might lie, as we say we have, but when you try to get we see its the wrong type...

----- Reply message -----
Von: "Lukas Kahwe Smith" <notifications@github.com>
An: "symfony-cmf/MenuBundle" <MenuBundle@noreply.github.com>
Cc: "David Buchmann" <david@liip.ch>
Betreff: [MenuBundle] handle case when no route can be found for the menu entry (#37)
Datum: Do., Feb. 28, 2013 23:13
In Provider/PHPCRMenuProvider.php: 
> @@ -106,7 +113,6 @@ public function get($name, array $options = array()) 
>       */ 
>      public function has($name, array $options = array()) 
>      { 
> -        $menu = $this->dm->find(null, $this->menuRoot . '/' . $name); 
> -        return $menu !== null; 
> +        return $this->dm->getPhpcrSession()->nodeExists($this->menuRoot . '/' . $name); 

yeah maybe .. checking for the correct type isnt so easy though. it would require reading the node and then checking for the class and classparents properties. 

also actually i am not sure if this change is really a performance improvement. i guess if it returns false, then there is very little performance change. and if returns true and we probably fetch the document right after anyway .. 

&mdash;
Reply to this email directly or view it on GitHub.