Skip to content
Browse files

Merge pull request #686 from vudaltsov/patch-1

Update DocumentRepository.php
  • Loading branch information...
2 parents c74b77a + 8f42c31 commit f353b2f3897f2502595ef4ce8b19e86ee6660625 @dbu dbu committed
Showing with 11 additions and 2 deletions.
  1. +3 −1 CHANGELOG.md
  2. +8 −1 lib/Doctrine/ODM/PHPCR/DocumentRepository.php
View
4 CHANGELOG.md
@@ -1,6 +1,8 @@
Changelog
=========
+* **2016-01-12**: Added `$repository->findBy(array('field' => array('val1', 'val2')))` support via `->orX()` method
+
1.3.0
-----
@@ -341,4 +343,4 @@ maintenance release of the 1.0 family with bugfixes
->execute(Query::HYDRATE_PHPCR);
* CreateQuery($statement, $language) has NOT been implemented in the new query builder.
It is, however, still available in the DocumentManager.
- * DocumentManager->getDocumentsByQuery renamed to getDocumentsByPhpcrQuery()
+ * DocumentManager->getDocumentsByQuery renamed to getDocumentsByPhpcrQuery()
View
9 lib/Doctrine/ODM/PHPCR/DocumentRepository.php
@@ -168,7 +168,14 @@ public function findBy(array $criteria, array $orderBy = null, $limit = null, $o
$where = $qb->andWhere();
}
- $this->constraintField($where, $field, $value, 'a');
+ if (is_array($value)) {
+ $where = $where->orX();
+ foreach ($value as $oneValue) {
+ $this->constraintField($where, $field, $oneValue, 'a');
+ }
+ } else {
+ $this->constraintField($where, $field, $value, 'a');
+ }
}
return $qb->getQuery()->execute();

0 comments on commit f353b2f

Please sign in to comment.
Something went wrong with that request. Please try again.