/** @ORM\PreRemove */ public function preRemove(DevisBook $book, LifecycleEventArgs $event) { $entityManager = $event->getEntityManager(); $cacheDriver = $entityManager->getConfiguration()->getResultCacheImpl(); $cacheDriver->delete('getBook_' . $book->getDevis()->getId()); }
/** * [setcoverPhoto description] * @param DevisBook $photo [description] * @param Devis $devis [description] * @return [type] [description] */ public function setcoverPhoto(DevisBook $photo, Devis $devis, $flush = true) { $oldCover = $this->repository->findOneBy(array('profile' => 1, 'devis' => $devis->getId())); $photo->setProfile(1); if ($oldCover) { $oldCover->setProfile(0); } try { if ($flush) { $this->em->flush(); $this->session->successFlashMessage('flash.message.devis.book.edit'); } return true; } catch (Exception $e) { $this->session->errorFlashMessage(); $this->logger->error($e->getMessage()); return false; } }