Get keyword information by ID

@param integer $keywordId
@param array $fields
@return \StdClass
@throws \Exception
518395
public function getKeyword($keywordId, $fields = ['name', 'slug', 'url'])
    {
        $apiUrl = $this->getEndpoint('keywords');
        $apiUrl .= $keywordId;

        $params = array(
            'fields' => implode(',', $fields)
        );

        $apiData = $this->apiGet($apiUrl, $params);

        return $this->decodeSingle($apiData);
    }
77666
function getUser($userId, array $fields = array())
    {
        $params = array(1, $this->username, $this->password, $userId);
        if (!empty($fields)) {
            $params[] = $fields;
        }

        return $this->sendRequest('wp.getUser', $params);
    }
900096
public Keyword getKeyword(String keywordId) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, keywordId);

        URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).buildUrl(parameters);
        String webpage = httpTools.getRequest(url);

        try {
            return MAPPER.readValue(webpage, Keyword.class);
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keyword " + keywordId, url, ex);
        }

    }
776717
public function search($vocabularyId)
    {
        $this->loadModel('Taxonomy.Terms');
        $out = [];
        $text = $this->request->query['q'];
        $terms = $this->Terms
            ->find()
            ->select(['id', 'name'])
            ->where(['name LIKE' => "%%{$text}%%", 'vocabulary_id' => $vocabularyId])
            ->limit(10)
            ->all();

        foreach ($terms as $term) {
            $out[] = ['id' => $term->id, 'name' => $term->name];
        }

        die(json_encode($out));
    }
692067
public function getIndexData(Field $field, FieldDefinition $fieldDefinition)
    {
        $tagKeywords = [];
        $parentTagIds = [];
        $tagIds = [];

        if (!empty($field->value->externalData)) {
            foreach ($field->value->externalData as $tag) {
                if (isset($tag['keywords'][$field->languageCode])) {
                    $tagKeywords[] = $tag['keywords'][$field->languageCode];
                    $parentTagIds[] = $tag['parent_id'];
                    $tagIds[] = $tag['id'];
                } elseif (isset($tag['keywords'][$tag['main_language_code']])) {
                    $tagKeywords[] = $tag['keywords'][$tag['main_language_code']];
                    $parentTagIds[] = $tag['parent_id'];
                    $tagIds[] = $tag['id'];
                } else {
                    // Something went wrong with the tag, we will not index it
                    continue;
                }
            }
        }

        return [
            new Search\Field(
                'tag_keywords',
                $tagKeywords,
                new Search\FieldType\MultipleStringField()
            ),
            new Search\Field(
                'parent_tag_ids',
                $parentTagIds,
                new Search\FieldType\MultipleIntegerField()
            ),
            new Search\Field(
                'tag_ids',
                $tagIds,
                new Search\FieldType\MultipleIntegerField()
            ),
            new Search\Field(
                'tag_text',
                implode(' ', $tagKeywords),
                new Search\FieldType\TextField()
            ),
            new Search\Field(
                'fulltext',
                implode(' ', $tagKeywords),
                new Search\FieldType\FullTextField()
            ),
        ];
    }
954413
static public function fetchByTagID( $tagID )
    {
        $objects = parent::fetchObjectList( self::definition(), null, array( 'keyword_id' => $tagID ) );

        if ( is_array( $objects ) )
            return $objects;

        return array();
    }
1344086
protected function loadContentTypeId($fieldDefinitionId)
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->select($this->connection->quoteIdentifier('contentclass_id'))
            ->from($this->connection->quoteIdentifier('ezcontentclass_attribute'))
            ->where(
                $query->expr()->eq('id', ':fieldDefinitionId')
            )
            ->setParameter(':fieldDefinitionId', $fieldDefinitionId);

        $statement = $query->execute();

        $row = $statement->fetch(\PDO::FETCH_ASSOC);

        if ($row === false) {
            throw new RuntimeException(
                sprintf(
                    'Content Type ID cannot be retrieved based on the field definition ID "%s"',
                    $fieldDefinitionId
                )
            );
        }

        return (int) $row['contentclass_id'];
    }
446414
public function select(...$fields) {
        $sql = new Query(...$fields);
        $sql->setDialect($this->dialect);

        return $sql;
    }
761645
protected function fetchUserId($fieldId)
    {
        $query = $this->connection->createQueryBuilder();
        $query
            ->select(
                $this->connection->quoteIdentifier('contentobject_id')
            )
            ->from($this->connection->quoteIdentifier('ezcontentobject_attribute'))
            ->where(
                $query->expr()->eq(
                    $this->connection->quoteIdentifier('id'),
                    ':fieldId'
                )
            )
            ->setParameter(':fieldId', $fieldId, PDO::PARAM_INT)
        ;

        $statement = $query->execute();

        return (int) $statement->fetchColumn();
    }
273057
public function getOneById($id)
    {
        $plugin = $this->getById($id);
        if (!$plugin) {
            throw new Exception(sprintf('Plugin "%s" not found', $id));
        }

        return $plugin;
    }
323093
public function getCategory($categoryId)
    {

        // try to load the category with the passed ID
        foreach ($this->categories as $category) {
            if ($category[MemberNames::ENTITY_ID] == $categoryId) {
                return $category;
            }
        }

        // throw an exception if the category is NOT available
        throw new \Exception(sprintf('Can\'t load category with ID %d in file %s on line %d', $categoryId));
    }
173871
protected function getExistingKeywords($keywordList, $contentTypeId)
    {
        // Retrieving potentially existing keywords
        $query = $this->connection->createQueryBuilder();
        $query
            ->select(
                $this->connection->quoteIdentifier('id'),
                $this->connection->quoteIdentifier('keyword')
            )
            ->from($this->connection->quoteIdentifier(self::KEYWORD_TABLE))
            ->where(
                $query->expr()->andX(
                    $query->expr()->in(
                        $this->connection->quoteIdentifier('keyword'),
                        ':keywordList'
                    ),
                    $query->expr()->eq(
                        $this->connection->quoteIdentifier('class_id'),
                        ':contentTypeId'
                    )
                )
            )
            ->setParameter(':keywordList', $keywordList, Connection::PARAM_STR_ARRAY)
            ->setParameter(':contentTypeId', $contentTypeId);

        $statement = $query->execute();

        $existingKeywordMap = [];
        foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
            // filter out keywords that aren't the exact match (e.g. differ by case)
            if (!in_array($row['keyword'], $keywordList)) {
                continue;
            }
            $existingKeywordMap[$row['keyword']] = $row['id'];
        }

        return $existingKeywordMap;
    }
1224592
public static function getFieldKey($fieldName, $fieldId)
    {
        if (isset(get_field_objects($fieldId)[$fieldName]['key'])) {
            return get_field_objects($fieldId)[$fieldName]['key'];
        }

        return false;
    }
259151
public function getCompany($companyId, $fields = ['*'])
    {
        $apiUrl = $this->getEndpoint('companies');
        $apiUrl .= $companyId;

        $params = array(
            'fields' => implode(',', $fields)
        );

        $apiData = $this->apiGet($apiUrl, $params);

        return $this->decodeSingle($apiData);
    }
785940
public function findByKeywords($keywords)
    {
        $qb = $this->createQueryBuilder();
        $qb->setQueryArray($this->transformConditionToMongoCondition($keywords));

        return $qb->getQuery()->execute();
    }
536631
public static function findField($fieldsList, $fieldId)
    {
        $fields = self::filterFieldList($fieldsList, $fieldId);

        if (1 != count($fields)) {
            return null;
        }

        return array_shift($fields);
    }
118610
public function updateEventMessageById($id, $fields) {
        $event = new \CEventMessage;
        if ($event->Update($id, $fields)) {
            return $id;
        }

        $this->throwException(__METHOD__, $event->LAST_ERROR);
    }