Pimcore\Model\Object\Data\KeyValue::getEntryByKeyId PHP Method

getEntryByKeyId() public method

public getEntryByKeyId ( $keyId ) : array | null
$keyId
return array | null
    public function getEntryByKeyId($keyId)
    {
        $result = [];
        foreach ($this->getProperties() as $property) {
            if ($property['key'] == $keyId) {
                $result[] = new Object\Data\KeyValue\Entry($property["value"], $property["translated"], $property["metadata"]);
            }
        }
        $count = count($result);
        if ($count == 0) {
            return null;
        } elseif ($count == 1) {
            return $result[0];
        } else {
            return $result;
        }
    }