Common\Doctrine\ValueObject\AbstractFile::removeOldFile PHP Метод

removeOldFile() защищенный Метод

This will remove the old file, can be extended to add extra functionality
protected removeOldFile ( )
    protected function removeOldFile()
    {
        // delete the old file
        $oldFile = $this->getUploadRootDir() . '/' . $this->oldFileName;
        if (is_file($oldFile) && file_exists($oldFile)) {
            unlink($oldFile);
        }
        $this->oldFileName = null;
    }

Usage Example

Пример #1
0
 /**
  * This will remove the old image and if needed the generated thumbnails
  */
 protected function removeOldFile()
 {
     if (static::GENERATE_THUMBNAILS && is_dir($this->getUploadRootDir())) {
         Model::deleteThumbnails($this->getUploadRootDir(), $this->oldFileName);
         return;
     }
     parent::removeOldFile();
 }