Skip to content

Commit

Permalink
Merge pull request #869 from qferr/fix/join-column
Browse files Browse the repository at this point in the history
Fixed condition for the join column
  • Loading branch information
qferr committed Jul 5, 2016
2 parents 9844b5b + 610e52a commit 58f4e37
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Grid/Source/Entity.php
Expand Up @@ -13,6 +13,7 @@
namespace APY\DataGridBundle\Grid\Source;

use APY\DataGridBundle\Grid\Column\Column;
use APY\DataGridBundle\Grid\Column\JoinColumn;
use APY\DataGridBundle\Grid\Rows;
use APY\DataGridBundle\Grid\Row;
use Doctrine\ORM\NoResultException;
Expand Down Expand Up @@ -350,7 +351,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr
}

if ($column->isSorted()) {
if ($column->getType() === 'join') {
if ($column instanceof JoinColumn) {
$this->query->resetDQLPart('orderBy');
foreach($column->getJoinColumns() as $columnName) {
$this->query->addOrderBy($this->getFieldName($columnsById[$columnName]), $column->getOrder());
Expand All @@ -373,7 +374,7 @@ public function execute($columns, $page = 0, $limit = 0, $maxResults = null, $gr
foreach ($filters as $filter) {
$operator = $this->normalizeOperator($filter->getOperator());

$columnForFilter = ($column->getType() !== 'join') ? $column : $columnsById[$filter->getColumnName()];
$columnForFilter = (!$column instanceof JoinColumn) ? $column : $columnsById[$filter->getColumnName()];

$fieldName = $this->getFieldName($columnForFilter, false);
$bindIndexPlaceholder = "?$bindIndex";
Expand Down

0 comments on commit 58f4e37

Please sign in to comment.