src/CRUDlex/FileHandler.php
public function deleteFiles(AbstractData $data, Entity $entity, $entityName)
    {
        $result = $data->getEvents()->shouldExecute($entity, 'before', 'deleteFiles');
        if (!$result) {
            return false;
        }
        $this->performOnFiles($entity, $entityName, function($entity, $entityName, $field) {
            // For now, we are defensive and don't delete ever. As soon as soft deletion is optional, files will get deleted.
        });
        $data->getEvents()->shouldExecute($entity, 'after', 'deleteFiles');
        return true;
    }
public function deleteFiles(AbstractData $data, Entity $entity, $entityName)
    {
        $result = $data->getEvents()->shouldExecute($entity, 'before', 'deleteFiles');
        if (!$result) {
            return false;
        }
        $this->performOnFiles($entity, $entityName, function($entity, $entityName, $field) {
            // For now, we are defensive and don't delete ever. As soon as soft deletion is optional, files will get deleted.
        });
        $data->getEvents()->shouldExecute($entity, 'after', 'deleteFiles');
        return true;
    }
public function deleteFiles ( AbstractData $ data , Entity $ entity , $ entityName ) { $ result = $ data -> getEvents ( ) -> shouldExecute ( $ entity , 'before' , 'deleteFiles' ) ; if ( ! $ result ) { return false ; } $ this -> performOnFiles ( $ entity , $ entityName , function ( $ entity , $ entityName , $ field ) { // For now, we are defensive and don't delete ever. As soon as soft deletion is optional, files will get deleted. } ) ; $ data -> getEvents ( ) -> shouldExecute ( $ entity , 'after' , 'deleteFiles' ) ; return true ; }
Deletes all files of an existing entity.

@param AbstractData $data
the AbstractData instance who should receive the events
@param Entity $entity
the entity to delete the files from
@param string $entityName
the name of the entity as this class here is not aware of it

@return boolean
true on successful deletion
Deletes all files of an existing entity .