Beispiel #1
0
 /**
  * @param FileInterface $file
  *
  * @return FileInterface
  * @throws \InvalidArgumentException
  */
 public function updateFile(FileInterface $file)
 {
     /**
      * @var File $file
      */
     if (!$file->getId()) {
         throw new \InvalidArgumentException('File needs to be persisted, before it can be updated');
     }
     if ($this->fileExists($file->getPath(), $file->getId())) {
         throw new \InvalidArgumentException('Another file with the same path already exists in the database');
     }
     $file->setModifiedTime(new \DateTime());
     return $this->updateFileInDb($file);
 }