private function checkWyposazenie($string, Oferty $oferta, $status) { $wyposazenie = $oferta->getWyposazenie(); foreach ($wyposazenie as $wyp) { if ($wyp->getWyposazenie()->getNazwawyposazenia() == $string && $status == false) { $Repository = $this->getDoctrine()->getRepository('AppBundle:Wyposazenie_Oferty'); $em = $this->getDoctrine()->getManager(); $em->remove($Repository->findOneBy(array('idWyposazenie' => $wyp->getIdWyposazenie()))); $em->flush(); return true; } else { if ($wyp->getWyposazenie()->getNazwawyposazenia() == $string && $status == true) { return true; } } } if ($status == true) { $Wyposazenie_Oferty = new Wyposazenie_Oferty(); $Wyposazenie_Oferty->setOferta($oferta); $Repository = $this->getDoctrine()->getRepository('AppBundle:Wyposazenie'); $Wyposazenie_Oferty->setWyposazenie($Repository->findOneBy(array('nazwawyposazenia' => $string))); $em = $this->getDoctrine()->getManager(); $em->persist($Wyposazenie_Oferty); $em->flush(); } return false; }
private function checkWyposazenie($string, $Oferta) { $Wyposazenie_Oferty = new Wyposazenie_Oferty(); $Wyposazenie_Oferty->setOferta($Oferta); $Repository = $this->getDoctrine()->getRepository('AppBundle:Wyposazenie'); $Wyposazenie_Oferty->setWyposazenie($Repository->findOneBy(array('nazwawyposazenia' => $string))); $em = $this->getDoctrine()->getManager(); $em->persist($Wyposazenie_Oferty); $em->flush(); }