本文整理汇总了PHP中Pimcore\Model\Element\Service::loadAllFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Service::loadAllFields方法的具体用法?PHP Service::loadAllFields怎么用?PHP Service::loadAllFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pimcore\Model\Element\Service
的用法示例。
在下文中一共展示了Service::loadAllFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadChilds
/**
* @param Element\ElementInterface $element
*/
public function loadChilds(Element\ElementInterface $element)
{
$this->amount++;
Element\Service::loadAllFields($element);
// for all
$element->getProperties();
if (method_exists($element, "getScheduledTasks")) {
$element->getScheduledTasks();
}
$element->_fulldump = true;
if (method_exists($element, "getChilds")) {
if ($element instanceof Object\AbstractObject) {
// because we also want variants
$childs = $element->getChilds(array(Object::OBJECT_TYPE_FOLDER, Object::OBJECT_TYPE_VARIANT, Object::OBJECT_TYPE_OBJECT));
} else {
$childs = $element->getChilds();
}
foreach ($childs as $child) {
$this->loadChilds($child);
}
}
}
示例2: save
/**
* @return void
*/
public function save()
{
// check if versioning is disabled for this process
if (self::$disabled) {
return;
}
if (!$this->date) {
$this->setDate(time());
}
$data = $this->getData();
// if necessary convert the data to save it to filesystem
if (is_object($data) or is_array($data)) {
// this is because of lazy loaded element inside documents and objects (eg: multihref, objects, fieldcollections, ...)
if ($data instanceof Element\ElementInterface) {
Element\Service::loadAllFields($data);
}
$this->setSerialized(true);
$data->_fulldump = true;
$dataString = Serialize::serialize($data);
// revert all changed made by __sleep()
if (method_exists($data, "__wakeup")) {
$data->__wakeup();
}
unset($data->_fulldump);
} else {
$dataString = $data;
}
$this->id = $this->getDao()->save();
// check if directory exists
$saveDir = dirname($this->getFilePath());
if (!is_dir($saveDir)) {
File::mkdir($saveDir);
}
// save data to filesystem
if (!is_writable(dirname($this->getFilePath())) || is_file($this->getFilePath()) && !is_writable($this->getFilePath())) {
throw new \Exception("Cannot save version for element " . $this->getCid() . " with type " . $this->getCtype() . " because the file " . $this->getFilePath() . " is not writeable.");
} else {
File::put($this->getFilePath(), $dataString);
// assets are kina special because they can contain massive amount of binary data which isn't serialized, we append it to the data file
if ($data instanceof Asset && $data->getType() != "folder") {
// append binary data to version file
$handle = fopen($this->getBinaryFilePath(), "w+");
$src = $data->getStream();
stream_copy_to_stream($src, $handle);
fclose($handle);
}
}
}
示例3: loadChilds
/**
* @param Element\ElementInterface $element
*/
public function loadChilds(Element\ElementInterface $element)
{
$this->amount++;
Element\Service::loadAllFields($element);
// for all
$element->getProperties();
if (method_exists($element, "getScheduledTasks")) {
$element->getScheduledTasks();
}
$element->_fulldump = true;
// we need to add the tag of each item to the cache cleared stack, so that the item doesn't gets into the cache
// with the property _fulldump set, because this would cause major issues in wakeUp()
\Pimcore\Cache::addClearedTag($element->getCacheTag());
if (method_exists($element, "getChilds")) {
if ($element instanceof Object\AbstractObject) {
// because we also want variants
$childs = $element->getChilds(array(Object::OBJECT_TYPE_FOLDER, Object::OBJECT_TYPE_VARIANT, Object::OBJECT_TYPE_OBJECT));
} else {
$childs = $element->getChilds();
}
foreach ($childs as $child) {
$this->loadChilds($child);
}
}
}