/** * @Route("/{id}", name="remove_profile_image", requirements={"id" = "\d+"}) * @ParamConverter("Image", class="ConnectionUserBundle:Profile\Image") */ public function removeAction(Image $image) { if (!($user = $this->getUser())) { throw new AccessDeniedException(); } if ($image->getGallery()->getUser()->getId() != $user->getId()) { throw new AccessDeniedException(); } $em = $this->getDoctrine()->getManager(); $em->remove($image); $em->flush(); return $this->redirect($this->generateUrl('edit_user_profile', array('tab' => 'gallery'))); }
/** * {@inheritDoc} */ public function getGallery() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getGallery', array()); return parent::getGallery(); }