Ublaboo\DataGrid\Row::getNextrasEntityProperty PHP Method

getNextrasEntityProperty() public method

Nextras: Access object properties to get a item value
public getNextrasEntityProperty ( Entity $item, string $key ) : mixed
$item Nextras\Orm\Entity\Entity
$key string
return mixed
    public function getNextrasEntityProperty(Nextras\Orm\Entity\Entity $item, $key)
    {
        $properties = explode('.', $key);
        $value = $item;
        while ($property = array_shift($properties)) {
            if (!isset($value->{$property})) {
                if ($this->datagrid->strict_entity_property) {
                    throw new DataGridException(sprintf('Target Property [%s] is not an object or is empty, trying to get [%s]', $value, str_replace('.', '->', $key)));
                }
                return NULL;
            }
            $value = $value->{$property};
        }
        return $value;
    }