From ab5032fa1f45e8bc59188e6960abc4bd6a9df88f Mon Sep 17 00:00:00 2001 From: David Buchmann Date: Sat, 28 Mar 2015 19:52:56 +0100 Subject: [PATCH] depend on symfony version that fixed the DoctrineType form --- .travis.yml | 6 ++---- Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php | 14 ++++++++++++-- Form/Type/DocumentType.php | 1 - composer.json | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 45b59616..8a18aecc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,16 +8,14 @@ php: - hhvm env: - - SYMFONY_VERSION=2.5.* + - SYMFONY_VERSION=2.6.* matrix: include: - php: 5.5 env: SYMFONY_VERSION=2.3.* - php: 5.5 - env: SYMFONY_VERSION=2.4.* - - php: 5.5 - env: SYMFONY_VERSION=2.6.* + env: SYMFONY_VERSION=2.7.* before_install: - composer self-update diff --git a/Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php b/Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php index 572a92a1..9163335a 100644 --- a/Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php +++ b/Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php @@ -3,6 +3,7 @@ namespace Doctrine\Bundle\PHPCRBundle\Form\ChoiceList; use Doctrine\Common\Persistence\ObjectManager; +use Doctrine\ODM\PHPCR\DocumentManager; use Doctrine\ODM\PHPCR\Query\Builder\QueryBuilder; use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface; use Symfony\Component\Form\Exception\FormException; @@ -32,10 +33,10 @@ class PhpcrOdmQueryBuilderLoader implements EntityLoaderInterface * Construct a PHPCR-ODM Query Builder Loader * * @param QueryBuilder|\Closure $queryBuilder - * @param ObjectManager $manager + * @param DocumentManager $manager * @param string $class */ - public function __construct($queryBuilder, ObjectManager $manager = null, $class = null) + public function __construct($queryBuilder, DocumentManager $manager = null, $class = null) { // If a query builder was passed, it must be a closure or QueryBuilder // instance @@ -51,6 +52,8 @@ public function __construct($queryBuilder, ObjectManager $manager = null, $class } } + $this->manager = $manager; + $this->queryBuilder = $queryBuilder; } @@ -77,6 +80,12 @@ public function getEntities() */ public function getEntitiesByIds($identifier, array $values) { + return $this->manager->findMany(null, $values); + + /* + * TODO: this query does not work. should we still use the query builder in this case? + * It seems the query builder does not properly translate the query for field 'id' to 'jcr:path' property. + $qb = clone $this->queryBuilder; $alias = $qb->getPrimaryAlias(); foreach ($values as $val) { @@ -84,6 +93,7 @@ public function getEntitiesByIds($identifier, array $values) } return $this->getResult($qb); + */ } /** diff --git a/Form/Type/DocumentType.php b/Form/Type/DocumentType.php index cd11e352..c36580f3 100644 --- a/Form/Type/DocumentType.php +++ b/Form/Type/DocumentType.php @@ -18,7 +18,6 @@ use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Bundle\PHPCRBundle\Form\ChoiceList\PhpcrOdmQueryBuilderLoader; -use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityLoaderInterface; use Symfony\Bridge\Doctrine\Form\Type\DoctrineType; class DocumentType extends DoctrineType diff --git a/composer.json b/composer.json index 84e48428..2ccc10f8 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "minimum-stability": "dev", "require": { "php": ">=5.3.3", - "symfony/framework-bundle": "~2.3", + "symfony/framework-bundle": "~2.3.27,~2.6.6,~2.7", "symfony/doctrine-bridge": "~2.3", "phpcr/phpcr-implementation": "2.1.*", "phpcr/phpcr-utils": "~1.2.0"