getCodes() as $code) { $reductionCart = $this->orderUtils->getReductionCartByCode($code); if ($reductionCart && $reductionCart->getId() != $entity->getId()) { $this->addFlash('error', "Le code " . $code . " est déjà utilisé dans la réduction #" . $reductionCart->getId() . " " . $reductionCart->getTitle()); $displayError = true; } } if ($displayError == false) parent::updateEntity($entity); } /* public function persistProductFamilyEntity($entity, $newForm) { $entity = $this->productFamilyUtils->processBeforePersistProductFamily($entity, $newForm); $this->em->persist($entity); $this->em->flush(); }*/ }