Exemplo n.º 1
0
 /**
  * @Route("/denied-ad/{id}", name="denied_ad")
  * @ParamConverter("ad", class="AppBundle:Ad")
  */
 public function deniedAdsAction(Ad $ad)
 {
     $em = $this->getDoctrine()->getManager();
     $ad->setStatus(3);
     $em->persist($ad);
     $em->flush();
     return $this->redirectToRoute("denied_ad_description", ['id' => $ad->getId()]);
 }
Exemplo n.º 2
0
 private function enforceOwnerSecurity(Ad $event)
 {
     $user = $this->getUser();
     if ($user != $event->getUser()) {
         throw new AccessDeniedException('You are not the owner!!!');
     }
 }