public function disableAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Actor $entity */
        $entity = $em->getRepository('CoreExtraBundle:Actor')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Actor  entity.');
        }
        
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (!$user->isGranted('ROLE_ADMIN')) {
            return $this->redirect($this->generateUrl('coreextra_newsletter_index'));
        }
        
        $entity->setNewsletter(false);
        $em->flush();

        $this->get('session')->getFlashBag()->add('success', 'newsletter.subscripts.disable');

        return $this->redirect($this->generateUrl('coreextra_newsletter_subscription'));
        
    }
public function disableAction($id)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var Actor $entity */
        $entity = $em->getRepository('CoreExtraBundle:Actor')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Actor  entity.');
        }
        
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (!$user->isGranted('ROLE_ADMIN')) {
            return $this->redirect($this->generateUrl('coreextra_newsletter_index'));
        }
        
        $entity->setNewsletter(false);
        $em->flush();

        $this->get('session')->getFlashBag()->add('success', 'newsletter.subscripts.disable');

        return $this->redirect($this->generateUrl('coreextra_newsletter_subscription'));
        
    }
public function disableAction ( $ id ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; /** @var Actor $entity */ $ entity = $ em -> getRepository ( 'CoreExtraBundle:Actor' ) -> find ( $ id ) ; if ( ! $ entity ) { throw $ this -> createNotFoundException ( 'Unable to find Actor  entity.' ) ; } $ user = $ this -> get ( 'security.token_storage' ) -> getToken ( ) -> getUser ( ) ; if ( ! $ user -> isGranted ( 'ROLE_ADMIN' ) ) { return $ this -> redirect ( $ this -> generateUrl ( 'coreextra_newsletter_index' ) ) ; } $ entity -> setNewsletter ( false ) ; $ em -> flush ( ) ; $ this -> get ( 'session' ) -> getFlashBag ( ) -> add ( 'success' , 'newsletter.subscripts.disable' ) ; return $ this -> redirect ( $ this -> generateUrl ( 'coreextra_newsletter_subscription' ) ) ; }
Edits an existing Subscriptors entity.

@param Request $request The request
@param int     $id      The entity id

@throws NotFoundHttpException
@return array|RedirectResponse

@Route("/subscription/{id}/disable")
Edits an existing Subscriptors entity .