/** * @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()]); }
private function enforceOwnerSecurity(Ad $event) { $user = $this->getUser(); if ($user != $event->getUser()) { throw new AccessDeniedException('You are not the owner!!!'); } }