Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

reproduced problem DDC-2844 #8

Closed
wants to merge 2 commits into
from
Jump to file or symbol
Failed to load files and symbols.
+121 −3
Split
View
@@ -16,6 +16,8 @@ public function registerBundles()
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
+ new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(),
+ new Hautelook\AliceBundle\HautelookAliceBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
@@ -648,8 +648,6 @@ class_exists('Locale'),
||
(extension_loaded('apc') && ini_get('apc.enabled'))
||
- (extension_loaded('Zend Optimizer+') && ini_get('zend_optimizerplus.enable'))
- ||
(extension_loaded('Zend OPcache') && ini_get('opcache.enable'))
||
(extension_loaded('xcache') && ini_get('xcache.cacher'))
View
@@ -65,3 +65,5 @@ swiftmailer:
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
+
+hautelook_alice: ~
View
@@ -18,7 +18,8 @@
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~2.3",
"sensio/generator-bundle": "~2.3",
- "incenteev/composer-parameter-handler": "~2.0"
+ "incenteev/composer-parameter-handler": "~2.0",
+ "hautelook/alice-bundle": "dev-master"
},
"scripts": {
"post-install-cmd": [
@@ -2,6 +2,8 @@
namespace Acme\DemoBundle\Controller;
+use Doctrine\Common\Collections\Criteria;
+use Doctrine\ORM\EntityRepository;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
@@ -19,6 +21,46 @@ class DemoController extends Controller
*/
public function indexAction()
{
+ /** @var \Doctrine\ORM\EntityRepository $userRepository */
+ $userRepository = $this->getDoctrine()->getRepository('AcmeDemoBundle:User');
+ $date = '2013-12-02';
+ $dateFrom = new \DateTime ($date);
+ $dateTo = (new \DateTime ($date))->add(new \DateInterval('P1D'));
+
+ // OK
+ $criteria = new Criteria();
+ $criteria
+ ->where($criteria->expr()->gte('signedIn', $dateFrom))
+ ->andWhere($criteria->expr()->lt('signedIn', $dateTo))
+ ;
+ //var_dump($userRepository->matching($criteria));
+
+ // NOT OK - Doctrine\ORM\Query\QueryException "Invalid parameter number: number of bound variables does not match number of tokens"
+ $criteria = new Criteria();
+ $criteria
+ ->where($criteria->expr()->gte('user.signedIn', $dateFrom))
+ ->andWhere($criteria->expr()->lt('user.signedIn', $dateTo))
+ ->orWhere ($criteria->expr()->eq ('user.signedIn', true))
+ ;
+ var_dump($userRepository->createQueryBuilder('user')
+ ->addCriteria($criteria)
+ ->getQuery()
+ ->getResult()
+ )
+ ;die();
+
+ // NOT OK - Doctrine\ORM\Query\QueryException "Invalid parameter number: number of bound variables does not match number of tokens"
+ $criteria
+ ->where($criteria->expr()->eq('user.active', true))
+ ->andWhere($criteria->expr()->eq('user.active', true))
+ //->orWhere ($criteria->expr ()->eq ('user.active', true))
+ ;
+ var_dump($userRepository->createQueryBuilder('user')
+ ->addCriteria($criteria)
+ ->getQuery()
+ ->getResult()
+ );
+
return array();
}
@@ -0,0 +1,19 @@
+<?php
+
+namespace Acme\DemoBundle\DataFixtures\ORM;
+
+use Hautelook\AliceBundle\Alice\DataFixtureLoader;
+use Nelmio\Alice\Fixtures;
+
+class TestLoader extends DataFixtureLoader
+{
+ /**
+ * {@inheritDoc}
+ */
+ protected function getFixtures()
+ {
+ return array(
+ __DIR__ . '/users.yml',
+ );
+ }
+}
@@ -0,0 +1,3 @@
+Acme\DemoBundle\Entity\User:
+ user{1..50}:
+ signedIn: <dateTimeBetween('-2 weeks', 'now')>
@@ -0,0 +1,33 @@
+<?php
+
+namespace Acme\DemoBundle\Entity;
+
+class User
+{
+ protected $id;
+ protected $signedIn;
+
+ /**
+ * @return mixed
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * @return mixed
+ */
+ public function getSignedIn()
+ {
+ return $this->signedIn;
+ }
+
+ /**
+ * @param mixed $signedIn
+ */
+ public function setSignedIn($signedIn)
+ {
+ $this->signedIn = $signedIn;
+ }
+}
@@ -0,0 +1,18 @@
+Acme\DemoBundle\Entity\User:
+ type: entity
+ #repositoryClass: Doctrine\Tests\ORM\Mapping\UserRepository
+ table: user
+ id:
+ id:
+ type: integer
+ generator:
+ strategy: AUTO
+ fields:
+ signedIn:
+ type: datetime
+# oneToOne:
+# address:
+# targetEntity: Address
+# joinColumn:
+# name: address_id
+# referencedColumnName: id