コード例 #1
0
 public function setAsset(Asset $asset)
 {
     $property = $this->getProperty();
     $property->referencedAssetId = $asset->getId();
     $property->referencedAssetPath = $asset->getPath();
     $property->referencedAssetType = $asset->getType();
     $asset = new \stdClass();
     $asset->{$p = $this->getPropertyName()} = $property;
     // edit asset
     $service = $this->getService();
     $service->edit($asset);
     if (!$service->isSuccessful()) {
         throw new e\EditingFailureException(S_SPAN . c\M::EDIT_ASSET_FAILURE . E_SPAN . $service->getMessage());
     }
     return $this->reloadProperty();
 }
コード例 #2
0
 public function deleteAsset(Asset $a)
 {
     $this->service->delete($this->service->createId($a->getType(), $a->getId()));
     if (!$this->service->isSuccessful()) {
         throw new e\DeletionErrorException(S_SPAN . c\M::DELETE_ASSET_FAILURE . E_SPAN . $e);
     }
     unset($a);
     return $this;
 }
コード例 #3
0
 public function setBaseAsset(Asset $a = NULL)
 {
     if (isset($a)) {
         $type = $a->getType();
         if (u\StringUtility::startsWith(strtolower($type), 'block')) {
             $type = 'block';
         } else {
             if (u\StringUtility::startsWith(strtolower($type), 'format')) {
                 $type = 'format';
             }
         }
         $this->getProperty()->assetType = $type;
         $this->getProperty()->baseAssetId = $a->getId();
         $this->getProperty()->baseAssetPath = $a->getPath();
     } else {
         $this->getProperty()->assetType = File::TYPE;
         // dummpy type
         $this->getProperty()->baseAssetId = NULL;
         $this->getProperty()->baseAssetPath = NULL;
     }
     return $this;
 }