public function preRemove(File $fileEntity, LifecycleEventArgs $args) { $dir = $this->publicDir . '/_cache'; if (is_dir($dir)) { foreach (Finder::findFiles('*/*/*/' . $fileEntity->getName())->from($dir) as $file) { unlink($file->getPathname()); } } }
public function saveState(array &$params, $reflection = null) { parent::saveState($params, $reflection); if ($this->dir !== null) { $params['dirId'] = $this->dir->getId(); } if ($this->file !== null) { $params['fileId'] = $this->file->getId(); } }