original_string: public function delete($contentId)
      {
          $this->loadModel('Content.Contents');
          $content = $this->Contents->get($contentId, ['contain' => ['ContentTypes']]);
  
          if (!$content || empty($content->content_type)) {
              throw new ContentNotFoundException(__d('content', 'The requested page was not found.'));
          }
  
          if (!$content->content_type->userAllowed('translate')) {
              throw new ContentDeleteException(__d('content', 'You are not allowed to delete contents of this type ({0}).', $content->content_type->name));
          }
  
          if ($this->Contents->delete($content, ['atomic' => true])) {
              $this->Flash->success(__d('content', 'Content was successfully removed!'));
          } else {
              $this->Flash->danger(__d('content', 'Unable to remove this content, please try again.'));
          }
  
          $this->title(__d('content', 'Delete Content'));
          $this->redirect($this->referer());
      }
code: public function delete($contentId)
      {
          $this->loadModel('Content.Contents');
          $content = $this->Contents->get($contentId, ['contain' => ['ContentTypes']]);
  
          if (!$content || empty($content->content_type)) {
              throw new ContentNotFoundException(__d('content', 'The requested page was not found.'));
          }
  
          if (!$content->content_type->userAllowed('translate')) {
              throw new ContentDeleteException(__d('content', 'You are not allowed to delete contents of this type ({0}).', $content->content_type->name));
          }
  
          if ($this->Contents->delete($content, ['atomic' => true])) {
              $this->Flash->success(__d('content', 'Content was successfully removed!'));
          } else {
              $this->Flash->danger(__d('content', 'Unable to remove this content, please try again.'));
          }
  
          $this->title(__d('content', 'Delete Content'));
          $this->redirect($this->referer());
      }
code_tokens: public function delete ( $ contentId ) { $ this -> loadModel ( 'Content.Contents' ) ; $ content = $ this -> Contents -> get ( $ contentId , [ 'contain' => [ 'ContentTypes' ] ] ) ; if ( ! $ content || empty ( $ content -> content_type ) ) { throw new ContentNotFoundException ( __d ( 'content' , 'The requested page was not found.' ) ) ; } if ( ! $ content -> content_type -> userAllowed ( 'translate' ) ) { throw new ContentDeleteException ( __d ( 'content' , 'You are not allowed to delete contents of this type ({0}).' , $ content -> content_type -> name ) ) ; } if ( $ this -> Contents -> delete ( $ content , [ 'atomic' => true ] ) ) { $ this -> Flash -> success ( __d ( 'content' , 'Content was successfully removed!' ) ) ; } else { $ this -> Flash -> danger ( __d ( 'content' , 'Unable to remove this content, please try again.' ) ) ; } $ this -> title ( __d ( 'content' , 'Delete Content' ) ) ; $ this -> redirect ( $ this -> referer ( ) ) ; }
docstring: Deletes the given content by ID.
  
  @param int $contentId Content's ID
  @return void
docstring_tokens: Deletes the given content by ID .