Пример #1
0
 /** @ORM\PostUpdate */
 public function PostUpdate(Devis $devis, LifecycleEventArgs $event)
 {
     $entity = $event->getEntity();
     $entityManager = $event->getEntityManager();
     $cacheDriver = $entityManager->getConfiguration()->getResultCacheImpl();
     $cacheDriver->delete('getCompanyDevis_' . $devis->getCompany()->getId());
     $cacheDriver->delete('getDevisPublic_' . $devis->getCompany()->getId());
 }
Пример #2
0
 /**
  * [generateCommission description]
  * @param  Devis  $devis [description]
  * @return [type]        [description]
  */
 public function generateCommission(Devis $devis)
 {
     $roles = $devis->getCompany()->getPhotographer()->getRoles();
     if ($devis->getCategory()->getType() == 1) {
         $commission = $this->serviceCommission->getCommissionParticulier();
         $commissionClient = $commission->getCustomer();
     } elseif ($devis->getCategory()->getType() == 2) {
         $commission = $this->serviceCommission->getCommissionEntreprise();
         $commissionClient = $commission->getCustomer();
     }
     if (in_array('ROLE_PHOTOGRAPHER_PREMIUM', $roles)) {
         $commissionPhotographer = $commission->getPremium();
     } else {
         $commissionPhotographer = $commission->getPhotographer();
     }
     $commissionPrestation = new CommissionPrestation();
     $commissionPrestation->setCustomer($commissionClient);
     $commissionPrestation->setPhotographer($commissionPhotographer);
     return $commissionPrestation;
 }