Pimcore\Model\Asset::getProperties PHP Method

getProperties() public method

public getProperties ( ) : Property[]
return Property[]
    public function getProperties()
    {
        if ($this->properties === null) {
            // try to get from cache
            $cacheKey = "asset_properties_" . $this->getId();
            $properties = \Pimcore\Cache::load($cacheKey);
            if (!is_array($properties)) {
                $properties = $this->getDao()->getProperties();
                $elementCacheTag = $this->getCacheTag();
                $cacheTags = ["asset_properties" => "asset_properties", $elementCacheTag => $elementCacheTag];
                \Pimcore\Cache::save($properties, $cacheKey, $cacheTags);
            }
            $this->setProperties($properties);
        }
        return $this->properties;
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param  Asset $target
  * @param  Asset $source
  * @return Asset copied asset
  */
 public function copyAsChild($target, $source)
 {
     $source->getProperties();
     $new = clone $source;
     $new->id = null;
     if ($new instanceof Asset\Folder) {
         $new->setChilds(null);
     }
     $new->setFilename(Element\Service::getSaveCopyName("asset", $new->getFilename(), $target));
     $new->setParentId($target->getId());
     $new->setUserOwner($this->_user->getId());
     $new->setUserModification($this->_user->getId());
     $new->setDao(null);
     $new->setLocked(false);
     $new->setCreationDate(time());
     $new->setStream($source->getStream());
     $new->save();
     if ($target instanceof Asset\Folder) {
         $this->updateChilds($target, $new);
     }
     return $new;
 }
All Usage Examples Of Pimcore\Model\Asset::getProperties