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

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

public load ( )
    public function load()
    {
        /** @var  $classificationStore Object\Classificationstore */
        $classificationStore = $this->model;
        $object = $this->model->getObject();
        $dataTableName = $this->getDataTableName();
        $objectId = $object->getId();
        $fieldname = $this->model->getFieldname();
        $query = "SELECT * FROM " . $dataTableName . " WHERE o_id = " . $this->db->quote($objectId) . " AND fieldname = " . $this->db->quote($fieldname);
        $data = $this->db->fetchAll($query);
        $groupCollectionMapping = [];
        foreach ($data as $item) {
            $groupId = $item["groupId"];
            $keyId = $item["keyId"];
            $collectionId = $item["collectionId"];
            $groupCollectionMapping[$groupId] = $collectionId;
            $value = ["value" => $item["value"], "value2" => $item["value2"]];
            $keyConfig = DefinitionCache::get($keyId);
            if (!$keyConfig) {
                Logger::error("Could not resolve key with ID: " . $keyId);
                continue;
            }
            $fd = Service::getFieldDefinitionFromKeyConfig($keyConfig);
            $value = $fd->unmarshal($value, $object);
            $value = $fd->getDataFromResource($value, $object);
            $language = $item["language"];
            $classificationStore->setLocalizedKeyValue($groupId, $keyId, $value, $language);
        }
        $groupsTableName = $this->getGroupsTableName();
        $query = "SELECT * FROM " . $groupsTableName . " WHERE o_id = " . $this->db->quote($objectId) . " AND fieldname = " . $this->db->quote($fieldname);
        $data = $this->db->fetchAll($query);
        $list = [];
        foreach ($data as $item) {
            $list[$item["groupId"]] = true;
        }
        $classificationStore->setActiveGroups($list);
        $classificationStore->setGroupCollectionMappings($groupCollectionMapping);
    }