/**
  * determineResourceClass
  *
  * @param $className
  */
 protected function determineResourceClass($className)
 {
     if (Tool::classExists($className)) {
         return $className;
     }
     return parent::determineResourceClass($className);
 }
示例#2
0
 /**
  * @param array $data
  * @return void
  */
 protected function assignVariablesToModel($data)
 {
     $this->model->setValues($data);
 }
示例#3
0
 /**
  * Saves the key config
  */
 public function save()
 {
     DefinitionCache::clear($this);
     $isUpdate = false;
     $def = \Zend_Json::decode($this->definition);
     if ($def && isset($def["title"])) {
         $this->title = $def["title"];
     } else {
         $this->title = null;
     }
     if ($this->getId()) {
         unset(self::$cache[$this->getId()]);
         $isUpdate = true;
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.preUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.preAdd", $this);
     }
     $model = parent::save();
     if ($isUpdate) {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.postUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.postAdd", $this);
     }
     return $model;
 }
示例#4
0
 /**
  * Saves the group config
  */
 public function save()
 {
     $isUpdate = false;
     if ($this->getId()) {
         $isUpdate = true;
         \Pimcore::getEventManager()->trigger("object.keyValue.groupConfig.preUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.keyValue.groupConfig.preAdd", $this);
     }
     $model = parent::save();
     if ($isUpdate) {
         \Pimcore::getEventManager()->trigger("object.keyValue.groupConfig.postUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.keyValue.groupConfig.postAdd", $this);
     }
     return $model;
 }
 /**
  * @param $object
  * @return void
  */
 public function delete($object)
 {
     $this->doDelete = true;
     parent::delete($object);
 }
 /**
  * @param $name
  * @param $arguments
  * @return array|mixed|null|void
  * @throws \Exception
  */
 public function __call($name, $arguments)
 {
     $sub = substr($name, 0, 14);
     if (substr($name, 0, 16) == "getWithGroupName") {
         $key = substr($name, 16, strlen($name) - 16);
         $groupConfig = Object\KeyValue\GroupConfig::getByName($arguments[0]);
         return $this->getProperty($key, $groupConfig->getId());
     } else {
         if (substr($name, 0, 14) == "getWithGroupId") {
             $key = substr($name, 14, strlen($name) - 14);
             $groupConfig = Object\KeyValue\GroupConfig::getById($arguments[0]);
             return $this->getProperty($key, $groupConfig->getId());
         } else {
             if (substr($name, 0, 3) == "get") {
                 $key = substr($name, 3, strlen($name) - 3);
                 return $this->getProperty($key);
             } else {
                 if (substr($name, 0, 3) == "set") {
                     $key = substr($name, 3, strlen($name) - 3);
                     return $this->setProperty($key, $arguments[0]);
                 }
             }
         }
     }
     return parent::__call($name, $arguments);
 }
示例#7
0
 /**
  * Deletes the key value key configuration
  */
 public function delete()
 {
     \Pimcore::getEventManager()->trigger("object.keyValue.keyConfig.preDelete", $this);
     if ($this->getId()) {
         unset(self::$cache[$this->getId()]);
     }
     parent::delete();
     \Pimcore::getEventManager()->trigger("object.keyValue.keyConfig.postDelete", $this);
 }
示例#8
0
 /**
  * Saves the key config
  */
 public function save()
 {
     DefinitionCache::clear($this);
     $isUpdate = false;
     if ($this->getId()) {
         unset(self::$cache[$this->getId()]);
         $isUpdate = true;
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.preUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.preAdd", $this);
     }
     $model = parent::save();
     if ($isUpdate) {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.postUpdate", $this);
     } else {
         \Pimcore::getEventManager()->trigger("object.Classificationstore.keyConfig.postAdd", $this);
     }
     return $model;
 }