public function removeRefusInPanierAction(Request $request, AdvertInterest $advertInterest) { $user = $this->getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('Vous devez être identifié pour pouvoir acceder à cette zone.'); } // Si on n'est pas dans la situation actuelle de 5 ( Desistement ) if ($advertInterest->getAdvertOptionType()->getId() == 3 and $advertInterest->getUser() == $user) { $em = $this->getDoctrine()->getManager(); $entity = $advertInterest->setCustomerFade(true); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('snoozit_platform_panier_homepage')); } throw new AccessDeniedException('Il y a un probleme de traitement dans removeRefusInPanierAction'); }
public function removeDesistInterestFromInterfaceAction(Request $request, AdvertInterest $advertInterest) { $em = $this->getDoctrine()->getManager(); $user = $this->getUser(); if (!is_object($user) || !$user instanceof UserInterface) { throw new AccessDeniedException('Vous devez être identifié pour pouvoir acceder à cette zone.'); } // Si on n'est pas dans la situation actuelle de 5 ( Desistement ) if ($advertInterest->getAdvertOptionType()->getId() == 5 or $advertInterest->getAdvertOptionType()->getId() == 3) { // Si l'utilisateur n'est ni le créateur de l'annonce ni l'interessé if ($advertInterest->getUser() != $user and $advertInterest->getAdvert()->getUser() != $user) { throw new AccessDeniedException('Vous n\'êtes pas concerné par cette interet.'); } if ($advertInterest->getUser() == $user) { $entity = $advertInterest->setCustomerFade(true); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('snoozit_platform_panier_homepage')); } // Si on est le créateur de l'annonce if ($advertInterest->getAdvert()->getUser() == $user) { $entity = $advertInterest->setOwnerFade(true); $em->persist($entity); $em->flush(); return $this->redirect($this->generateUrl('snoozit_dashboard_interest')); } throw new AccessDeniedException('Cet interet ne peut pas etre effacer'); } throw new AccessDeniedException('Il y a un probleme de traitement dans removeDesistInterestFromInterface'); }