original_string: public function deleteAction($id)
  	{
  		$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page !');
  		$postManager = $this->get('asf_document.post.manager');
  		
  		$post = $postManager->getRepository()->findOneBy(array('id' => $id));
  
  		try {
  			if ( is_null($post) )
  				throw new \Exception($this->get('translator')->trans('An error occurs when deleting the post', array(), 'asf_document'));
  			
  			$postManager->getEntityManager()->remove($post);
  			$postManager->getEntityManager()->flush();
  			
  			if ( $this->has('asf_layout.flash_message') ) {
  				$this->get('asf_layout.flash_message')->success($this->get('translator')->trans('The post "%name%" successfully deleted', array('%name%' => $post->getTitle()), 'asf_document'));
  			}
  			
  		} catch (\Exception $e) {
  			if ( $this->has('asf_layout.flash_message') ) {
  				$this->get('asf_layout.flash_message')->danger($e->getMessage());
  			}
  		}
  		
  		return $this->redirect($this->get('router')->generate('asf_document_post_list'));
  	}
code: public function deleteAction($id)
  	{
  		$this->denyAccessUnlessGranted('ROLE_ADMIN', null, 'Unable to access this page !');
  		$postManager = $this->get('asf_document.post.manager');
  		
  		$post = $postManager->getRepository()->findOneBy(array('id' => $id));
  
  		try {
  			if ( is_null($post) )
  				throw new \Exception($this->get('translator')->trans('An error occurs when deleting the post', array(), 'asf_document'));
  			
  			$postManager->getEntityManager()->remove($post);
  			$postManager->getEntityManager()->flush();
  			
  			if ( $this->has('asf_layout.flash_message') ) {
  				$this->get('asf_layout.flash_message')->success($this->get('translator')->trans('The post "%name%" successfully deleted', array('%name%' => $post->getTitle()), 'asf_document'));
  			}
  			
  		} catch (\Exception $e) {
  			if ( $this->has('asf_layout.flash_message') ) {
  				$this->get('asf_layout.flash_message')->danger($e->getMessage());
  			}
  		}
  		
  		return $this->redirect($this->get('router')->generate('asf_document_post_list'));
  	}
code_tokens: public function deleteAction ( $ id ) { $ this -> denyAccessUnlessGranted ( 'ROLE_ADMIN' , null , 'Unable to access this page !' ) ; $ postManager = $ this -> get ( 'asf_document.post.manager' ) ; $ post = $ postManager -> getRepository ( ) -> findOneBy ( array ( 'id' => $ id ) ) ; try { if ( is_null ( $ post ) ) throw new \ Exception ( $ this -> get ( 'translator' ) -> trans ( 'An error occurs when deleting the post' , array ( ) , 'asf_document' ) ) ; $ postManager -> getEntityManager ( ) -> remove ( $ post ) ; $ postManager -> getEntityManager ( ) -> flush ( ) ; if ( $ this -> has ( 'asf_layout.flash_message' ) ) { $ this -> get ( 'asf_layout.flash_message' ) -> success ( $ this -> get ( 'translator' ) -> trans ( 'The post "%name%" successfully deleted' , array ( '%name%' => $ post -> getTitle ( ) ) , 'asf_document' ) ) ; } } catch ( \ Exception $ e ) { if ( $ this -> has ( 'asf_layout.flash_message' ) ) { $ this -> get ( 'asf_layout.flash_message' ) -> danger ( $ e -> getMessage ( ) ) ; } } return $ this -> redirect ( $ this -> get ( 'router' ) -> generate ( 'asf_document_post_list' ) ) ; }
docstring: Delete a post
  
  @param  integer $id           ASFDocumentBundle:Post Entity ID
  @throws AccessDeniedException If user does not have ACL's rights for delete the post
  @throws \Exception            Error on post not found or on removing element from DB
  @return \Symfony\Component\HttpFoundation\RedirectResponse
docstring_tokens: Delete a post