Example #1
0
 /**
  * [updatePreferences description]
  * @param  Preference $preference [description]
  * @param  [type]     $params     [description]
  * @return [type]                 [description]
  */
 public function updatePreferences(Preference $preference, $params)
 {
     $preference->setPrestation($params['prestation']);
     $preference->setNewsletter($params['newsletter']);
     $preference->setMessages($params['messages']);
     try {
         $this->em->flush();
         $this->session->successFlashMessage('flash.message.email.index');
         return true;
     } catch (\Exception $e) {
         $this->session->errorFlashMessage();
         $this->logger->error($e->getMessage());
         return false;
     }
 }
Example #2
0
 /** @ORM\PostUpdate */
 public function postUpdate(Preference $preference, LifecycleEventArgs $event)
 {
     $entityManager = $event->getEntityManager();
     $cacheDriver = $entityManager->getConfiguration()->getResultCacheImpl();
     $cacheDriver->delete('getUserPreferences_' . $preference->getUser()->getId());
 }