Pimcore\Model\Object\Classificationstore::setObject PHP Метод

setObject() публичный Метод

public setObject ( Concrete $object )
$object Concrete
    public function setObject($object)
    {
        if (!$object instanceof Concrete) {
            throw new \Exception("not instance of Concrete");
        }
        $this->object = $object;
        //$this->setClass($this->getObject()->getClass());
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * @param $object
  * @param array $params
  * @return Object\Localizedfield
  * @throws \Exception
  */
 public function preGetData($object, $params = [])
 {
     if (!$object instanceof Object\Concrete) {
         throw new \Exception("Localized Fields are only valid in Objects");
     }
     if (!$object->{$this->getName()} instanceof Object\Classificationstore) {
         $store = new Object\Classificationstore();
         $store->setObject($object);
         $store->setFieldname($this->getName());
         $object->{$this->getName()} = $store;
     }
     return $object->{$this->getName()};
 }