public function setFile(a\File $file = NULL)
 {
     // required
     if ($this->required && $file == NULL) {
         throw new e\EmptyValueException(S_SPAN . c\M::NULL_FILE . E_SPAN);
     }
     if ($this->asset_type != c\T::FILE) {
         throw new e\NodeException(S_SPAN . "The asset does not accept a file." . E_SPAN);
     }
     if (isset($file)) {
         $this->file_id = $file->getId();
         $this->file_path = $file->getPath();
     } else {
         $this->file_id = NULL;
         $this->file_path = NULL;
     }
     return $this;
 }
コード例 #2
0
 public function removeFile(File $file)
 {
     $id = $file->getId();
     $temp = array();
     foreach ($this->files as $file) {
         if ($file->getId() != $id) {
             $temp[] = $file;
         }
     }
     $this->files = $temp;
     return $this;
 }