private function checkFormWyposazenie($string, Oferty $oferta) { $wyposazenie = $oferta->getWyposazenie(); foreach ($wyposazenie as $wyp) { if ($wyp->getWyposazenie()->getNazwawyposazenia() == $string) { return true; } } return false; }