public function beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->config('status')) {
            return true;
        }

        if (!$options['atomic']) {
            throw new FatalErrorException(__d('field', 'Entities in fieldable tables can only be deleted using transaction. Set [atomic = true]'));
        }

        foreach ($this->_attributesForEntity($entity) as $attr) {
            $field = $this->_prepareMockField($entity, $attr);
            $result = $field->beforeDelete();

            if ($result === false) {
                $event->stopPropagation();

                return false;
            }

            // holds in cache field mocks, so we can catch them on afterDelete
            $this->_cache['afterDelete'][] = $field;
        }

        return true;
    }
public function beforeDelete(Event $event, EntityInterface $entity, ArrayObject $options)
    {
        if (!$this->config('status')) {
            return true;
        }

        if (!$options['atomic']) {
            throw new FatalErrorException(__d('field', 'Entities in fieldable tables can only be deleted using transaction. Set [atomic = true]'));
        }

        foreach ($this->_attributesForEntity($entity) as $attr) {
            $field = $this->_prepareMockField($entity, $attr);
            $result = $field->beforeDelete();

            if ($result === false) {
                $event->stopPropagation();

                return false;
            }

            // holds in cache field mocks, so we can catch them on afterDelete
            $this->_cache['afterDelete'][] = $field;
        }

        return true;
    }
public function beforeDelete ( Event $ event , EntityInterface $ entity , ArrayObject $ options ) { if ( ! $ this -> config ( 'status' ) ) { return true ; } if ( ! $ options [ 'atomic' ] ) { throw new FatalErrorException ( __d ( 'field' , 'Entities in fieldable tables can only be deleted using transaction. Set [atomic = true]' ) ) ; } foreach ( $ this -> _attributesForEntity ( $ entity ) as $ attr ) { $ field = $ this -> _prepareMockField ( $ entity , $ attr ) ; $ result = $ field -> beforeDelete ( ) ; if ( $ result === false ) { $ event -> stopPropagation ( ) ; return false ; } // holds in cache field mocks, so we can catch them on afterDelete $ this -> _cache [ 'afterDelete' ] [ ] = $ field ; } return true ; }
Deletes an entity from a fieldable table.

@param \Cake\Event\Event $event The event that was triggered
@param \Cake\Datasource\EntityInterface $entity The entity being deleted
@param \ArrayObject $options Additional options given as an array
@return bool
@throws \Cake\Error\FatalErrorException When using this behavior in non-atomic mode
Deletes an entity from a fieldable table .