public function removeNegociationAction(AdvertNegoce $advertNegoce) { if ($this->getUser() != $advertNegoce->getAdvert()->getUser()) { throw new AccessDeniedException('Cette négociation ne vous concerne pas.'); } $this->get('sz_advert_negoce_handler')->removeNegoce($advertNegoce); return $this->redirect($this->generateUrl('snoozit_dashboard_negociation')); }
public function removeNegoce(AdvertNegoce $advertNegoce) { $this->containerInterface->get('event_dispatcher')->dispatch(SkuagEvents::ON_REFUSE_NEGOCE, new NegoceEvent($advertNegoce->getAdvert(), $advertNegoce->getUser(), $this->getPrice())); $this->entityManager->remove($advertNegoce); $this->entityManager->flush(); return; }
public function advertNegoceNotification(AdvertNegoce $entity) { $message = new \Swift_Message("Une proposition vient d'arriver", $this->getTemplating()->render('SnoozitPlatformBundle:Mail/DoctrineListener/Persist:NegoceMail.html.twig', array('slug' => $entity->getAdvert()->getSlug(), 'id' => $entity->getAdvert()->getId(), 'title' => $entity->getAdvert()->getTitle(), 'userInterested' => $this->getUsername(), 'ownername' => $entity->getUser()->getUsername())), 'text/html'); $message->addTo('*****@*****.**')->addFrom('*****@*****.**'); $this->mailer->send($message); }