em->getRepository("TicketSupportBundle:TicketIntervenant")->findOneBy(['publicKey'=>$publicKey]); } /** * @param TicketIntervenant $element * @return bool */ public function update(TicketIntervenant $element) { return $this->quickUpdate($element); } /** * @param TicketIntervenant $element * @return bool */ public function quickUpdate(TicketIntervenant $element) { if (!$this->em->contains($element)) { try { $this->em->persist($element); } catch (ORMException $e) { return false; } } try { $this->em->flush(); } catch (OptimisticLockException $e) { return false; } catch (ORMException $e) { return false; } return true; } /** * @param TicketIntervenant $element * @return bool */ public function delete(TicketIntervenant $element) { try { $this->em->remove($element); $this->em->flush($element); } catch (ORMException $e) { return false; } return true; } /** * @param TicketItem $ticket * @param CustomUserInterface $user * @return TicketIntervenant|null|object */ public function findIntervenant(TicketItem $ticket, CustomUserInterface $user){ return $this->em->getRepository("TicketSupportBundle:TicketIntervenant")->findOneBy(['ticket'=>$ticket,'user'=>$user]); } }