Skip to content

Commit

Permalink
depend on symfony version that fixed the DoctrineType form
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Apr 7, 2015
1 parent daeb3fe commit ab5032f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 12 additions & 2 deletions Form/ChoiceList/PhpcrOdmQueryBuilderLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -51,6 +52,8 @@ public function __construct($queryBuilder, ObjectManager $manager = null, $class
}
}

$this->manager = $manager;

$this->queryBuilder = $queryBuilder;
}

Expand All @@ -77,13 +80,20 @@ 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) {
$qb->orWhere()->eq()->field($alias.'.'.$identifier)->literal($val);
}
return $this->getResult($qb);
*/
}

/**
Expand Down
1 change: 0 additions & 1 deletion Form/Type/DocumentType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit ab5032f

Please sign in to comment.