當前位置: 首頁>>代碼示例>>PHP>>正文


PHP AbstractObject::update方法代碼示例

本文整理匯總了PHP中Pimcore\Model\Object\AbstractObject::update方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractObject::update方法的具體用法?PHP AbstractObject::update怎麽用?PHP AbstractObject::update使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Pimcore\Model\Object\AbstractObject的用法示例。


在下文中一共展示了AbstractObject::update方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update

 /**
  * @return void
  */
 public function update()
 {
     parent::update();
     $this->getResource()->update();
 }
開發者ID:rolandstoll,項目名稱:pimcore,代碼行數:8,代碼來源:Folder.php

示例2: update

 /**
  * @return void
  */
 protected function update()
 {
     parent::update();
     $this->getDao()->update();
 }
開發者ID:pimcore,項目名稱:pimcore,代碼行數:8,代碼來源:Folder.php

示例3: update

 /**
  * @throws \Exception
  */
 protected function update()
 {
     $fieldDefintions = $this->getClass()->getFieldDefinitions();
     foreach ($fieldDefintions as $fd) {
         $getter = "get" . ucfirst($fd->getName());
         $setter = "set" . ucfirst($fd->getName());
         if (method_exists($this, $getter)) {
             //To make sure, inherited values are not set again
             $inheritedValues = AbstractObject::doGetInheritedValues();
             AbstractObject::setGetInheritedValues(false);
             $value = $this->{$getter}();
             if (is_array($value) and ($fd instanceof ClassDefinition\Data\Multihref or $fd instanceof ClassDefinition\Data\Objects)) {
                 //don't save relations twice
                 $this->{$setter}(array_unique($value));
             }
             AbstractObject::setGetInheritedValues($inheritedValues);
             $value = $this->{$getter}();
             $omitMandatoryCheck = $this->getOmitMandatoryCheck();
             /*$timeSinceCreation = (time()-$this->getCreationDate());
               if($timeSinceCreation <= 5){
                   // legacy hack: in previous version there was no check for mandatory fields,
                   // and everybody uses the save method for new object creation - so now let's evict the mandatory check
                   // if the object was created within the last 5 seconds
                   $omitMandatoryCheck=true;
                   \Logger::debug("executing mandatory fields check for object [ ".$this->getId()." ]");
               }
               */
             //check throws Exception
             try {
                 $fd->checkValidity($value, $omitMandatoryCheck);
             } catch (\Exception $e) {
                 if ($this->getClass()->getAllowInherit()) {
                     //try again with parent data when inheritance in activated
                     try {
                         $getInheritedValues = AbstractObject::doGetInheritedValues();
                         AbstractObject::setGetInheritedValues(true);
                         $value = $this->{$getter}();
                         $fd->checkValidity($value, $omitMandatoryCheck);
                         AbstractObject::setGetInheritedValues($getInheritedValues);
                     } catch (\Exception $e) {
                         throw new \Exception($e->getMessage() . " fieldname=" . $fd->getName());
                     }
                 } else {
                     throw new \Exception($e->getMessage() . " fieldname=" . $fd->getName());
                 }
             }
         }
     }
     parent::update();
     $this->getResource()->update();
     // scheduled tasks are saved in $this->saveVersion();
     $this->saveVersion(false, false);
     $this->saveChilds();
 }
開發者ID:pawansgi92,項目名稱:pimcore2,代碼行數:57,代碼來源:Concrete.php

示例4: update

 /**
  * @throws \Exception
  */
 protected function update()
 {
     $fieldDefintions = $this->getClass()->getFieldDefinitions();
     foreach ($fieldDefintions as $fd) {
         $getter = "get" . ucfirst($fd->getName());
         $setter = "set" . ucfirst($fd->getName());
         if (method_exists($this, $getter)) {
             //To make sure, inherited values are not set again
             $inheritedValues = AbstractObject::doGetInheritedValues();
             AbstractObject::setGetInheritedValues(false);
             $value = $this->{$getter}();
             if (is_array($value) and ($fd instanceof ClassDefinition\Data\Multihref or $fd instanceof ClassDefinition\Data\Objects)) {
                 //don't save relations twice
                 $this->{$setter}(array_unique($value));
             }
             AbstractObject::setGetInheritedValues($inheritedValues);
             $value = $this->{$getter}();
             $omitMandatoryCheck = $this->getOmitMandatoryCheck();
             //check throws Exception
             try {
                 $fd->checkValidity($value, $omitMandatoryCheck);
             } catch (\Exception $e) {
                 if ($this->getClass()->getAllowInherit()) {
                     //try again with parent data when inheritance in activated
                     try {
                         $getInheritedValues = AbstractObject::doGetInheritedValues();
                         AbstractObject::setGetInheritedValues(true);
                         $value = $this->{$getter}();
                         $fd->checkValidity($value, $omitMandatoryCheck);
                         AbstractObject::setGetInheritedValues($getInheritedValues);
                     } catch (\Exception $e) {
                         throw new \Exception($e->getMessage() . " fieldname=" . $fd->getName());
                     }
                 } else {
                     throw new \Exception($e->getMessage() . " fieldname=" . $fd->getName());
                 }
             }
         }
     }
     parent::update();
     $this->getDao()->update();
     // scheduled tasks are saved in $this->saveVersion();
     $this->saveVersion(false, false);
     $this->saveChildData();
 }
開發者ID:sfie,項目名稱:pimcore,代碼行數:48,代碼來源:Concrete.php

示例5: update

 /**
  * @return void
  */
 public function update()
 {
     parent::update();
     $this->getDao()->update();
 }
開發者ID:ChristophWurst,項目名稱:pimcore,代碼行數:8,代碼來源:Folder.php


注:本文中的Pimcore\Model\Object\AbstractObject::update方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。