List a collection of webcorners public function getStuff($brand)
{
    $web=FALSE;
        if($this-&gt;getWebcorners()):
            foreach ($this-&gt;getWebcorners() as $webcorner):
                if(strtolower($webcorner-&gt;getBrand()-&gt;getName())== $brand):
                    return $webcorner;
                endif;
                if($webcorner-&gt;getBrandId()==NULL):
                    $web=$webcorner;
                endif;
            endforeach;
        endif;
    return $web;
}


the function is suppose to list a collection of webcorners and return the first that matches a brand, then the one that is null (in this order).  There's a possibility to have many other webcorners according to the brand (but no matching the one that is passed by parameter to the function).
Just cleaned up your method a little: (Guard condition, better variable name, less nesting)

public function getStuff($brand)
{
    if(!$this-&gt;getWebcorners()) return false;
    $fallback=false;
    foreach ($this-&gt;getWebcorners() as $webcorner) {
        if(strtolower($webcorner-&gt;getBrand()-&gt;getName())== $brand) return $webcorner;
        if($webcorner-&gt;getBrandId()==NULL) $fallback=$webcorner;
    }
    return $fallback;
}


If you want to return the first item without a brand you have to add the $fallback==false condition to your second if. Otherwise you use the last suitable item.