setClassDefinitions() public method

public setClassDefinitions ( $classDefinitions )
$classDefinitions
Example #1
0
 public function objectbrickUpdateAction()
 {
     try {
         $key = $this->getParam("key");
         if ($this->getParam("task") == "add") {
             // check for existing brick with same name with different lower/upper cases
             $list = new Object\Objectbrick\Definition\Listing();
             $list = $list->load();
             foreach ($list as $item) {
                 if (strtolower($key) === strtolower($item->getKey())) {
                     throw new \Exception("Brick with the same name already exists (lower/upper cases may be different)");
                 }
             }
         }
         // now we create a new definition
         $fc = new Object\Objectbrick\Definition();
         $fc->setKey($key);
         if ($this->getParam("values")) {
             $values = \Zend_Json::decode($this->getParam("values"));
             $fc->setParentClass($values["parentClass"]);
             $fc->setClassDefinitions($values["classDefinitions"]);
         }
         if ($this->getParam("configuration")) {
             $configuration = \Zend_Json::decode($this->getParam("configuration"));
             $configuration["datatype"] = "layout";
             $configuration["fieldtype"] = "panel";
             $layout = Object\ClassDefinition\Service::generateLayoutTreeFromArray($configuration, true);
             $fc->setLayoutDefinitions($layout);
         }
         $fc->save();
         $this->_helper->json(["success" => true, "id" => $fc->getKey()]);
     } catch (\Exception $e) {
         Logger::error($e->getMessage());
         $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
     }
 }
Example #2
0
 public function objectbrickUpdateAction()
 {
     try {
         $fc = new Object\Objectbrick\Definition();
         $fc->setKey($this->getParam("key"));
         if ($this->getParam("values")) {
             $values = \Zend_Json::decode($this->getParam("values"));
             $fc->setParentClass($values["parentClass"]);
             $fc->setClassDefinitions($values["classDefinitions"]);
         }
         if ($this->getParam("configuration")) {
             $configuration = \Zend_Json::decode($this->getParam("configuration"));
             $configuration["datatype"] = "layout";
             $configuration["fieldtype"] = "panel";
             $layout = Object\ClassDefinition\Service::generateLayoutTreeFromArray($configuration, true);
             $fc->setLayoutDefinitions($layout);
         }
         $fc->save();
         $this->_helper->json(array("success" => true, "id" => $fc->getKey()));
     } catch (\Exception $e) {
         \Logger::error($e->getMessage());
         $this->_helper->json(["success" => false, "message" => $e->getMessage()]);
     }
 }