Skip to content

Commit 0d93196

Browse files
committed
Improve readability as suggested in GH code review
1 parent bd86a47 commit 0d93196

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/Persisters/Entity/BasicEntityPersister.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,8 +958,17 @@ public function expandCriteriaParameters(Criteria $criteria)
958958
$value = [$value];
959959
}
960960

961-
$nonNullValues = array_diff_key($value, array_flip(array_keys($value, null, true)));
962-
foreach ($nonNullValues as $item) {
961+
foreach ($value as $item) {
962+
if ($item === null) {
963+
/*
964+
* Compare this to how \Doctrine\ORM\Persisters\Entity\BasicEntityPersister::getSelectConditionStatementSQL
965+
* creates the "[NOT] IN (...)" expression - for NULL values, it does _not_ insert a placeholder in the
966+
* SQL and instead adds an extra ... OR ... IS NULL condition. So we need to skip NULL values here as
967+
* well to create a parameters list that matches the SQL.
968+
*/
969+
continue;
970+
}
971+
963972
$sqlParams = array_merge($sqlParams, PersisterHelper::convertToParameterValue($item, $this->em));
964973
$sqlTypes = array_merge($sqlTypes, PersisterHelper::inferParameterTypes($field, $item, $this->class, $this->em));
965974
}

0 commit comments

Comments
 (0)