diff --git a/Grid/Source/Entity.php b/Grid/Source/Entity.php index 78cc0f99..fcb40b35 100644 --- a/Grid/Source/Entity.php +++ b/Grid/Source/Entity.php @@ -17,11 +17,12 @@ use APY\DataGridBundle\Grid\Column\JoinColumn; use APY\DataGridBundle\Grid\Row; use APY\DataGridBundle\Grid\Rows; +use Doctrine\ORM\Mapping\ReflectionEmbeddedProperty; use Doctrine\ORM\NoResultException; use Doctrine\ORM\Query; -use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\ResultSetMapping; +use Doctrine\ORM\QueryBuilder; use Doctrine\ORM\Tools\Pagination\CountWalker; use Doctrine\ORM\Tools\Pagination\Paginator; use Symfony\Component\HttpKernel\Kernel; @@ -202,6 +203,13 @@ protected function getFieldName($column, $withAlias = false) return $column->getField(); } + $reflectionFields = $this->ormMetadata->getReflectionProperties(); + $reflectionProperty = (isset($reflFields[$name])) ? $reflectionFields[$name] : null; + + if ($reflectionProperty instanceof ReflectionEmbeddedProperty) { + return $this->getTableAlias() . '.' . $name; + } + if (strpos($name, '.') !== false) { $previousParent = '';