src/CRUDlex/AbstractData.php
public function delete($entity)
    {
        $result = $this->events->shouldExecute($entity, 'before', 'delete');
        if (!$result) {
            return static::DELETION_FAILED_EVENT;
        }
        $result = $this->doDelete($entity, $this->definition->isDeleteCascade());
        $this->events->shouldExecute($entity, 'after', 'delete');
        return $result;
    }
public function delete($entity)
    {
        $result = $this->events->shouldExecute($entity, 'before', 'delete');
        if (!$result) {
            return static::DELETION_FAILED_EVENT;
        }
        $result = $this->doDelete($entity, $this->definition->isDeleteCascade());
        $this->events->shouldExecute($entity, 'after', 'delete');
        return $result;
    }
public function delete ( $ entity ) { $ result = $ this -> events -> shouldExecute ( $ entity , 'before' , 'delete' ) ; if ( ! $ result ) { return static :: DELETION_FAILED_EVENT ; } $ result = $ this -> doDelete ( $ entity , $ this -> definition -> isDeleteCascade ( ) ) ; $ this -> events -> shouldExecute ( $ entity , 'after' , 'delete' ) ; return $ result ; }
Deletes an entry from the datasource.

@param Entity $entity
the entity to delete

@return integer
returns one of:
- AbstractData::DELETION_SUCCESS -> successful deletion
- AbstractData::DELETION_FAILED_STILL_REFERENCED -> failed deletion due to existing references
- AbstractData::DELETION_FAILED_EVENT -> failed deletion due to a failed before delete event
Deletes an entry from the datasource .