diff --git a/src/Model/Table/AssetsTable.php b/src/Model/Table/AssetsTable.php index b1f77e2..50874fe 100644 --- a/src/Model/Table/AssetsTable.php +++ b/src/Model/Table/AssetsTable.php @@ -4,6 +4,7 @@ namespace Assets\Model\Table; use ArrayObject; +use Assets\Model\Entity\Asset; use Cake\Core\Configure; use Cake\Datasource\EntityInterface; use Cake\Event\EventInterface; @@ -131,11 +132,13 @@ public function beforeFind(EventInterface $e, Query $query, ArrayObject $options return $query->orderDesc('modified'); } - public function afterDelete(EventInterface $e, EntityInterface $entity, ArrayObject $options) + public function afterDelete(EventInterface $e, Asset $entity, ArrayObject $options): bool { if (Configure::read('AssetsPlugin.AssetsTable.deleteFile') === true) { - FileSystem::delete(ROOT . DS . $entity->directory . $entity->filename); + FileSystem::delete($entity->absolute_path); } + + return true; } /**