Skip to content

Commit

Permalink
Fix errors with PHP < 5.5
Browse files Browse the repository at this point in the history
  • Loading branch information
alcaeus committed Dec 17, 2015
1 parent 55bff8b commit 8c7398f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,9 @@ private function prepareQueryElement($fieldName, $value = null, $class = null, $
}

// No further preparation unless we're dealing with a simple reference
if (empty($mapping['reference']) || empty($mapping['simple']) || empty((array) $value)) {
// We can't have expressions in empty() with PHP < 5.5, so store it in a variable
$arrayValue = (array) $value;
if (empty($mapping['reference']) || empty($mapping['simple']) || empty($arrayValue)) {
return array($fieldName, $value);
}

Expand Down

0 comments on commit 8c7398f

Please sign in to comment.