Pimcore\Model\Object\AbstractObject::update PHP Method

update() protected method

protected update ( )
    protected function update()
    {
        // set mod date
        $this->setModificationDate(time());
        if (!$this->getCreationDate()) {
            $this->setCreationDate(time());
        }
        // save properties
        $this->getProperties();
        $this->getDao()->deleteAllProperties();
        if (is_array($this->getProperties()) and count($this->getProperties()) > 0) {
            foreach ($this->getProperties() as $property) {
                if (!$property->getInherited()) {
                    $property->setDao(null);
                    $property->setCid($this->getId());
                    $property->setCtype("object");
                    $property->setCpath($this->getRealFullPath());
                    $property->save();
                }
            }
        }
        // save dependencies
        $d = $this->getDependencies();
        $d->clean();
        foreach ($this->resolveDependencies() as $requirement) {
            if ($requirement["id"] == $this->getId() && $requirement["type"] == "object") {
                // dont't add a reference to yourself
                continue;
            } else {
                $d->addRequirement($requirement["id"], $requirement["type"]);
            }
        }
        $d->save();
        //set object to registry
        \Zend_Registry::set("object_" . $this->getId(), $this);
    }

Usage Example

Example #1
0
 /**
  * @return void
  */
 public function update()
 {
     parent::update();
     $this->getResource()->update();
 }
All Usage Examples Of Pimcore\Model\Object\AbstractObject::update