Ublaboo\DataGrid\Row::getDoctrineEntityProperty PHP Method

getDoctrineEntityProperty() public method

Doctrine: Access object properties to get a item value
public getDoctrineEntityProperty ( mixed $item, mixed $key ) : mixed
$item mixed
$key mixed
return mixed
    public function getDoctrineEntityProperty($item, $key)
    {
        $properties = explode('.', $key);
        $value = $item;
        $accessor = PropertyAccessHelper::getAccessor();
        while ($property = array_shift($properties)) {
            if (!is_object($value) && !$value) {
                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 = $accessor->getValue($value, $property);
        }
        return $value;
    }