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

public getKeyId ( ) : integer
Результат integer
 public function relationsAction()
 {
     if ($this->getParam("data")) {
         $dataParam = $this->getParam("data");
         $data = \Zend_Json::decode($dataParam);
         $keyId = $data["keyId"];
         $groupId = $data["groupId"];
         $sorter = $data["sorter"];
         $config = new Classificationstore\KeyGroupRelation();
         $config->setGroupId($groupId);
         $config->setKeyId($keyId);
         $config->setSorter($sorter);
         $config->save();
         $data["id"] = $config->getGroupId() . "-" . $config->getKeyId();
         $this->_helper->json(array("success" => true, "data" => $data));
     } else {
         $mapping = array("keyName" => "name", "keyDescription" => "description");
         $start = 0;
         $limit = 15;
         $orderKey = "name";
         $order = "ASC";
         if ($this->getParam("dir")) {
             $order = $this->getParam("dir");
         }
         $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
         if ($sortingSettings['orderKey'] && $sortingSettings['order']) {
             $orderKey = $sortingSettings['orderKey'];
             $order = $sortingSettings['order'];
         }
         if ($this->getParam("overrideSort") == "true") {
             $orderKey = "id";
             $order = "DESC";
         }
         if ($this->getParam("limit")) {
             $limit = $this->getParam("limit");
         }
         if ($this->getParam("start")) {
             $start = $this->getParam("start");
         }
         $list = new Classificationstore\KeyGroupRelation\Listing();
         if ($limit > 0) {
             $list->setLimit($limit);
         }
         $list->setOffset($start);
         $list->setOrder($order);
         $list->setOrderKey($orderKey);
         if ($this->getParam("filter")) {
             $db = Db::get();
             $condition = "";
             $filterString = $this->getParam("filter");
             $filters = json_decode($filterString);
             $count = 0;
             foreach ($filters as $f) {
                 if ($count > 0) {
                     $condition .= " AND ";
                 }
                 $count++;
                 $fieldname = $mapping[$f->field];
                 $condition .= $db->getQuoteIdentifierSymbol() . $fieldname . $db->getQuoteIdentifierSymbol() . " LIKE " . $db->quote("%" . $f->value . "%");
             }
         }
         $groupId = $this->getParam("groupId");
         if ($condition) {
             $condition = "( " . $condition . " ) AND";
         }
         $condition .= " groupId = " . $list->quote($groupId);
         $list->setCondition($condition);
         $listItems = $list->load();
         $rootElement = array();
         $data = array();
         foreach ($listItems as $config) {
             $item = array("keyId" => $config->getKeyId(), "groupId" => $config->getGroupId(), "keyName" => $config->getName(), "keyDescription" => $config->getDescription(), "id" => $config->getGroupId() . "-" . $config->getKeyId(), "sorter" => $config->getSorter());
             $data[] = $item;
         }
         $rootElement["data"] = $data;
         $rootElement["success"] = true;
         $rootElement["total"] = $list->getTotalCount();
         return $this->_helper->json($rootElement);
     }
 }
 public function relationsAction()
 {
     if ($this->getParam("data")) {
         $dataParam = $this->getParam("data");
         $data = \Zend_Json::decode($dataParam);
         $keyId = $data["keyId"];
         $groupId = $data["groupId"];
         $sorter = $data["sorter"];
         $mandatory = $data["mandatory"];
         $config = new Classificationstore\KeyGroupRelation();
         $config->setGroupId($groupId);
         $config->setKeyId($keyId);
         $config->setSorter($sorter);
         $config->setMandatory($mandatory);
         $config->save();
         $data["id"] = $config->getGroupId() . "-" . $config->getKeyId();
         $this->_helper->json(["success" => true, "data" => $data]);
     } else {
         $mapping = ["keyName" => "name", "keyDescription" => "description"];
         $start = 0;
         $limit = 15;
         $orderKey = "name";
         $order = "ASC";
         if ($this->getParam("dir")) {
             $order = $this->getParam("dir");
         }
         $sortingSettings = \Pimcore\Admin\Helper\QueryParams::extractSortingSettings($this->getAllParams());
         if ($sortingSettings['orderKey'] && $sortingSettings['order']) {
             $orderKey = $sortingSettings['orderKey'];
             $order = $sortingSettings['order'];
         }
         if ($this->getParam("overrideSort") == "true") {
             $orderKey = "id";
             $order = "DESC";
         }
         if ($this->getParam("limit")) {
             $limit = $this->getParam("limit");
         }
         if ($this->getParam("start")) {
             $start = $this->getParam("start");
         }
         $list = new Classificationstore\KeyGroupRelation\Listing();
         if ($limit > 0) {
             $list->setLimit($limit);
         }
         $list->setOffset($start);
         $list->setOrder($order);
         $list->setOrderKey($orderKey);
         if ($this->getParam("filter")) {
             $db = Db::get();
             $conditionParts = [];
             $filterString = $this->getParam("filter");
             $filters = json_decode($filterString);
             $count = 0;
             foreach ($filters as $f) {
                 $count++;
                 $fieldname = $mapping[$f->field];
                 $conditionParts[] = $db->getQuoteIdentifierSymbol() . $fieldname . $db->getQuoteIdentifierSymbol() . " LIKE " . $db->quote("%" . $f->value . "%");
             }
         }
         if (!$this->getParam("relationIds")) {
             $groupId = $this->getParam("groupId");
             $conditionParts[] = " groupId = " . $list->quote($groupId);
         }
         $relationIds = $this->getParam("relationIds");
         if ($relationIds) {
             $relationIds = json_decode($relationIds, true);
             $relationParts = [];
             foreach ($relationIds as $relationId) {
                 $keyId = $relationId["keyId"];
                 $groupId = $relationId["groupId"];
                 $relationParts[] = "(keyId = " . $keyId . " and groupId = " . $groupId . ")";
             }
             $conditionParts[] = "(" . implode(" OR ", $relationParts) . ")";
         }
         $condition = implode(" AND ", $conditionParts);
         $list->setCondition($condition);
         $listItems = $list->load();
         $rootElement = [];
         $data = [];
         /** @var  $config Classificationstore\KeyGroupRelation */
         foreach ($listItems as $config) {
             $type = $config->getType();
             $definition = json_decode($config->getDefinition());
             $definition = \Pimcore\Model\Object\Classificationstore\Service::getFieldDefinitionFromJson($definition, $type);
             $item = ["keyId" => $config->getKeyId(), "groupId" => $config->getGroupId(), "keyName" => $config->getName(), "keyDescription" => $config->getDescription(), "id" => $config->getGroupId() . "-" . $config->getKeyId(), "sorter" => $config->getSorter(), "layout" => $definition, "mandatory" => $config->isMandatory()];
             $data[] = $item;
         }
         $rootElement["data"] = $data;
         $rootElement["success"] = true;
         $rootElement["total"] = $list->getTotalCount();
         return $this->_helper->json($rootElement);
     }
 }