Pimcore\Model\Object\Data\KeyValue::getProperty PHP Метод

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

public getProperty ( $propName, null $groupId = null ) : array | null
$propName
$groupId null
Результат array | null
    public function getProperty($propName, $groupId = null)
    {
        $keyId = $this->getKeyId($propName, $groupId);
        $result = [];
        // the key name is valid, now iterate over the object's pairs
        $propsWithInheritance = $this->getProperties();
        foreach ($propsWithInheritance as $pair) {
            if ($pair["key"] == $keyId) {
                $result[] = new Object\Data\KeyValue\Entry($pair["value"], $pair["translated"], $pair["metadata"]);
            }
        }
        $count = count($result);
        if ($count == 0) {
            return null;
        } elseif ($count == 1) {
            return $result[0];
        } else {
            return $result;
        }
    }