public function beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->trash($entity, $options->getArrayCopy())) {
            throw new RuntimeException();
        }

        $event->stopPropagation();

        /** @var \Cake\ORM\Table $table */
        $table = $event->getSubject();
        $table->dispatchEvent('Model.afterDelete', [
            'entity' => $entity,
            'options' => $options,
        ]);

        return true;
    }
public function beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->trash($entity, $options->getArrayCopy())) {
            throw new RuntimeException();
        }

        $event->stopPropagation();

        /** @var \Cake\ORM\Table $table */
        $table = $event->getSubject();
        $table->dispatchEvent('Model.afterDelete', [
            'entity' => $entity,
            'options' => $options,
        ]);

        return true;
    }
public function beforeDelete ( Event $ event , EntityInterface $ entity , ArrayObject $ options ) { if ( ! $ this -> trash ( $ entity , $ options -> getArrayCopy ( ) ) ) { throw new RuntimeException ( ) ; } $ event -> stopPropagation ( ) ; /** @var \Cake\ORM\Table $table */ $ table = $ event -> getSubject ( ) ; $ table -> dispatchEvent ( 'Model.afterDelete' , [ 'entity' => $ entity , 'options' => $ options , ] ) ; return true ; }
Callback to never really delete a record but instead mark it as `trashed`.

@param \Cake\Event\Event $event The beforeDelete event that was fired.
@param \Cake\Datasource\EntityInterface $entity The entity to be deleted.
@param \ArrayObject $options Options.
@return true
@throws \RuntimeException if fails to mark entity as `trashed`.
Callback to never really delete a record but instead mark it as trashed .