original_string: protected function _processDelete($entity, $options)
      {
          if ($entity->isNew()) {
              return false;
          }
  
          $primaryKey = (array)$this->getPrimaryKey();
          if (!$entity->has($primaryKey)) {
              $msg = 'Deleting requires all primary key values.';
              throw new InvalidArgumentException($msg);
          }
  
          if ($options['checkRules'] && !$this->checkRules($entity, RulesChecker::DELETE, $options)) {
              return false;
          }
  
          $event = $this->dispatchEvent('Model.beforeDelete', [
              'entity' => $entity,
              'options' => $options
          ]);
  
          if ($event->isStopped()) {
              return $event->getResult();
          }
  
          $this->_associations->cascadeDelete(
              $entity,
              ['_primary' => false] + $options->getArrayCopy()
          );
  
          $query = $this->query();
          $conditions = (array)$entity->extract($primaryKey);
          $statement = $query->delete()
              ->where($conditions)
              ->execute();
  
          $success = $statement->rowCount() > 0;
          if (!$success) {
              return $success;
          }
  
          $this->dispatchEvent('Model.afterDelete', [
              'entity' => $entity,
              'options' => $options
          ]);
  
          return $success;
      }
code: protected function _processDelete($entity, $options)
      {
          if ($entity->isNew()) {
              return false;
          }
  
          $primaryKey = (array)$this->getPrimaryKey();
          if (!$entity->has($primaryKey)) {
              $msg = 'Deleting requires all primary key values.';
              throw new InvalidArgumentException($msg);
          }
  
          if ($options['checkRules'] && !$this->checkRules($entity, RulesChecker::DELETE, $options)) {
              return false;
          }
  
          $event = $this->dispatchEvent('Model.beforeDelete', [
              'entity' => $entity,
              'options' => $options
          ]);
  
          if ($event->isStopped()) {
              return $event->getResult();
          }
  
          $this->_associations->cascadeDelete(
              $entity,
              ['_primary' => false] + $options->getArrayCopy()
          );
  
          $query = $this->query();
          $conditions = (array)$entity->extract($primaryKey);
          $statement = $query->delete()
              ->where($conditions)
              ->execute();
  
          $success = $statement->rowCount() > 0;
          if (!$success) {
              return $success;
          }
  
          $this->dispatchEvent('Model.afterDelete', [
              'entity' => $entity,
              'options' => $options
          ]);
  
          return $success;
      }
code_tokens: protected function _processDelete ( $ entity , $ options ) { if ( $ entity -> isNew ( ) ) { return false ; } $ primaryKey = ( array ) $ this -> getPrimaryKey ( ) ; if ( ! $ entity -> has ( $ primaryKey ) ) { $ msg = 'Deleting requires all primary key values.' ; throw new InvalidArgumentException ( $ msg ) ; } if ( $ options [ 'checkRules' ] && ! $ this -> checkRules ( $ entity , RulesChecker :: DELETE , $ options ) ) { return false ; } $ event = $ this -> dispatchEvent ( 'Model.beforeDelete' , [ 'entity' => $ entity , 'options' => $ options ] ) ; if ( $ event -> isStopped ( ) ) { return $ event -> getResult ( ) ; } $ this -> _associations -> cascadeDelete ( $ entity , [ '_primary' => false ] + $ options -> getArrayCopy ( ) ) ; $ query = $ this -> query ( ) ; $ conditions = ( array ) $ entity -> extract ( $ primaryKey ) ; $ statement = $ query -> delete ( ) -> where ( $ conditions ) -> execute ( ) ; $ success = $ statement -> rowCount ( ) > 0 ; if ( ! $ success ) { return $ success ; } $ this -> dispatchEvent ( 'Model.afterDelete' , [ 'entity' => $ entity , 'options' => $ options ] ) ; return $ success ; }
docstring: Perform the delete operation.
  
  Will delete the entity provided. Will remove rows from any
  dependent associations, and clear out join tables for BelongsToMany associations.
  
  @param \Cake\Datasource\EntityInterface $entity The entity to delete.
  @param \ArrayObject $options The options for the delete.
  @throws \InvalidArgumentException if there are no primary key values of the
  passed entity
  @return bool success
docstring_tokens: Perform the delete operation .