Skip to content

Commit

Permalink
relationship: fixed filtering primary key with 0 (zero)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrach committed Apr 24, 2015
1 parent 1f0e311 commit 65627ae
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Mapper/Dbal/RelationshipMapperHasOne.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Nextras\Orm\Repository\IRepository;
use Nextras\Orm\Mapper\IMapper;
use Nextras\Orm\NotSupportedException;
use Nextras\Orm\LogicException;


/**
Expand Down Expand Up @@ -88,7 +87,10 @@ protected function execute(DbalCollection $collection, IEntity $parent)

protected function fetch(QueryBuilder $builder, $hasJoin, array $values)
{
$values = array_values(array_unique(array_filter($values)));
$values = array_values(array_unique(array_filter($values, function($value) {
return $value !== NULL;
})));

if (count($values) === 0) {
return new EntityContainer([]);
}
Expand Down

0 comments on commit 65627ae

Please sign in to comment.