Exemplo n.º 1
0
 /**
  * Loads a list of Classificationstore group configs for the specified parameters, returns an array of config elements
  *
  * @return array
  */
 public function load()
 {
     $condition = $this->getCondition();
     if ($condition) {
         $condition = $condition . " AND ";
     } else {
         $condition = " where ";
     }
     $condition .= Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . ".keyId = " . Object\Classificationstore\KeyConfig\Dao::TABLE_NAME_KEYS . ".id";
     $resourceGroupName = $this->model->getResolveGroupName();
     if ($resourceGroupName) {
         $condition .= " and " . Object\Classificationstore\GroupConfig\Dao::TABLE_NAME_GROUPS . ".id = " . Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . ".groupId";
     }
     $sql = "SELECT " . Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . ".*," . Object\Classificationstore\KeyConfig\Dao::TABLE_NAME_KEYS . ".*";
     if ($resourceGroupName) {
         $sql .= ", " . Object\Classificationstore\GroupConfig\Dao::TABLE_NAME_GROUPS . ".name as groupName";
     }
     $sql .= " FROM " . Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . "," . Object\Classificationstore\KeyConfig\Dao::TABLE_NAME_KEYS;
     if ($resourceGroupName) {
         $sql .= ", " . Object\Classificationstore\GroupConfig\Dao::TABLE_NAME_GROUPS;
     }
     $sql .= $condition;
     $sql .= $this->getOrder() . $this->getOffsetLimit();
     $data = $this->db->fetchAll($sql, $this->model->getConditionVariables());
     $configData = [];
     foreach ($data as $dataItem) {
         $entry = new Object\Classificationstore\KeyGroupRelation();
         $resource = $entry->getDao();
         $resource->assignVariablesToModel($dataItem);
         $configData[] = $entry;
     }
     $this->model->setList($configData);
     return $configData;
 }
Exemplo n.º 2
0
Arquivo: Dao.php Projeto: sfie/pimcore
 /**
  * Loads a list of Classificationstore group configs for the specifies parameters, returns an array of config elements
  *
  * @return array
  */
 public function load()
 {
     $condition = $this->getCondition();
     if ($condition) {
         $condition = $condition . " AND ";
     } else {
         $condition = " where ";
     }
     $condition .= Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . ".keyId = " . Object\Classificationstore\KeyConfig\Dao::TABLE_NAME_KEYS . ".id";
     $sql = "SELECT * FROM " . Object\Classificationstore\KeyGroupRelation\Dao::TABLE_NAME_RELATIONS . "," . Object\Classificationstore\KeyConfig\Dao::TABLE_NAME_KEYS . $condition . $this->getOrder() . $this->getOffsetLimit();
     $data = $this->db->fetchAll($sql, $this->model->getConditionVariables());
     $configData = array();
     foreach ($data as $dataItem) {
         $entry = new Object\Classificationstore\KeyGroupRelation();
         $resource = $entry->getDao();
         $resource->assignVariablesToModel($dataItem);
         $configData[] = $entry;
     }
     $this->model->setList($configData);
     return $configData;
 }