Skip to content

Commit 1035776

Browse files
committed
depend on symfony version that fixed the DoctrineType form
1 parent daeb3fe commit 1035776

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Doctrine\Bundle\PHPCRBundle\Form\ChoiceList;
44

55
use Doctrine\Common\Persistence\ObjectManager;
6+
use Doctrine\ODM\PHPCR\DocumentManager;
67
use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder;
78
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
89
use Symfony\Component\Form\Exception\FormException;
@@ -32,10 +33,10 @@ class PhpcrOdmQueryBuilderLoader implements EntityLoaderInterface
3233
* Construct a PHPCR-ODM Query Builder Loader
3334
*
3435
* @param QueryBuilder|\Closure $queryBuilder
35-
* @param ObjectManager $manager
36+
* @param DocumentManager $manager
3637
* @param string $class
3738
*/
38-
public function __construct($queryBuilder, ObjectManager $manager = null, $class = null)
39+
public function __construct($queryBuilder, DocumentManager $manager = null, $class = null)
3940
{
4041
// If a query builder was passed, it must be a closure or QueryBuilder
4142
// instance
@@ -51,6 +52,8 @@ public function __construct($queryBuilder, ObjectManager $manager = null, $class
5152
}
5253
}
5354

55+
$this->manager = $manager;
56+
5457
$this->queryBuilder = $queryBuilder;
5558
}
5659

@@ -77,13 +80,20 @@ public function getEntities()
7780
*/
7881
public function getEntitiesByIds($identifier, array $values)
7982
{
83+
return $this->manager->findMany(null, $values);
84+
85+
/*
86+
* TODO: this query does not work. should we still use the query builder in this case?
87+
* It seems the query builder does not properly translate the query for field 'id' to 'jcr:path' property.
88+
8089
$qb = clone $this->queryBuilder;
8190
$alias = $qb->getPrimaryAlias();
8291
foreach ($values as $val) {
8392
$qb->orWhere()->eq()->field($alias.'.'.$identifier)->literal($val);
8493
}
8594
8695
return $this->getResult($qb);
96+
*/
8797
}
8898

8999
/**

Form/Type/DocumentType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
use Doctrine\Common\Persistence\ObjectManager;
2020
use Doctrine\Bundle\PHPCRBundle\Form\ChoiceList\PhpcrOdmQueryBuilderLoader;
21-
use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface;
2221
use Symfony\Bridge\Doctrine\Form\Type\DoctrineType;
2322

2423
class DocumentType extends DoctrineType

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"minimum-stability": "dev",
1919
"require": {
2020
"php": ">=5.3.3",
21-
"symfony/framework-bundle": "~2.3",
21+
"symfony/framework-bundle": "~2.3,>=2.3.27",
2222
"symfony/doctrine-bridge": "~2.3",
2323
"phpcr/phpcr-implementation": "2.1.*",
2424
"phpcr/phpcr-utils": "~1.2.0"
@@ -40,7 +40,8 @@
4040
"burgov/key-value-form-bundle": "to edit assoc multivalue properties. require version 1.0.*"
4141
},
4242
"conflict": {
43-
"phpcr/phpcr-shell": "<1.0.0-beta1"
43+
"phpcr/phpcr-shell": "<1.0.0-beta1",
44+
"symfony/framework-bundle": ">=2.6.0,<2.6.6"
4445
},
4546
"autoload": {
4647
"psr-4": { "Doctrine\\Bundle\\PHPCRBundle\\": "" }

0 commit comments

Comments
 (0)