On Wed, Feb 05, 2014 at 11:48:27AM +0100, Marco Pivetta wrote:
> Hi Thomas,
>
> About the validation, I was explicitly asking for the ouput of the
> `orm:validate-schema` CLI command.
$ ./symfony.sh doctrine:schema:validate
[Mapping] OK - The mapping files are correct.
[Database] OK - The database schema is in sync with the mapping files.
Aka, OK :=)
> The warning about "illegal offset type" at
> https://github.com/doctrine/doctrine2/blob/v2.4.1/lib/Doctrine/ORM/Query/SqlWalker.php#L601is
> quite strange - can you eventually spin up XDebug and see
> parameters/stack traces for that exception?
I have stacktraces, attatched and pastebin:
http://pastebin.com/5eGYdn8t
> If that doesn't help, then I suggest writing a test case like the ones in
> https://github.com/doctrine/doctrine2/tree/v2.4.1/tests/Doctrine/Tests/ORM/Functional/Ticket,
> which would allow us to debug it in more detail.
That's some job :=) But useful for sure, if we do find a bug and not me
being silly.
Thomas.
>
> Marco Pivetta
>
> http://twitter.com/Ocramius
>
> http://ocramius.github.com/
>
>
> On 5 February 2014 11:24, Thomas Lundquist <[email protected]>wrote:
>
> > On Wed, Feb 05, 2014 at 11:08:45AM +0100, Marco Pivetta wrote:
> > > Hi Thomas,
> > >
> > > I don't see any obvious mistakes in your query - did you validate your
> > > mappings first?
> >
> > They are OK, when there are items with that itemfunctions, it will find
> > frogs.
> >
> > (I did run it, no complains.)
> >
> > > What is the exact version of doctrine/orm in your `composer.lock`?
> >
> > "name": "doctrine/orm",
> > "version": "v2.4.1",
> >
> > (Sorry for forgetting this one)
> >
> > But, I'll give you a more exact (but maybe embarrasing) query:
> >
> > $dql = <<<EODQL
> > SELECT m
> > FROM NTE\InventoryBundle\Entity\Model m
> > WHERE
> > m.id in (
> > SELECT distinct(i.model)
> > FROM NTE\InventoryBundle\Entity\Item i
> > WHERE i.function = :itemfunction
> > )
> > EODQL;
> >
> > As you can see, "Frog" is actually named "Model", which may have been a bad
> > mistake as it may work as if it were a reserved word. (And it's confusing
> > anyway..)
> >
> > But it shouldn't break just when there are no items with that function.
> >
> >
> > Thomas.
> >
> > >
> > >
> > > Marco Pivetta
> > >
> > > http://twitter.com/Ocramius
> > >
> > > http://ocramius.github.com/
> > >
> > >
> > > On 5 February 2014 11:05, Thomas Lundquist <[email protected]
> > >wrote:
> > >
> > > >
> > > > Hello group.
> > > >
> > > >
> > > > I have this little query in a repo:
> > > >
> > > > -- snip --
> > > >
> > > > $dql = <<<EODQL
> > > > SELECT f
> > > > FROM Foo\BarBundle\Entity\Frog f
> > > > WHERE
> > > > f.id in (
> > > > SELECT distinct(i.frog)
> > > > FROM NTE\InventoryBundle\Entity\Item i
> > > > WHERE i.function = :itemfunction
> > > > )
> > > > EODQL;
> > > >
> > > > $q = $this->_em->createQuery($dql);
> > > > $q->setParameter('itemfunction', $itemfunction);
> > > >
> > > > return $q->getResult();
> > > >
> > > > -- snip --
> > > >
> > > > When there are no items with the itemfunction from the sub select, I
> > end up
> > > > with these two:
> > > >
> > > > PHP Warning: Illegal offset type in
> > > > doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php on line 601,
> > > >
> > > > And
> > > >
> > > > PHP Fatal error: Call to a member function getTableName() on a
> > non-object
> > > > in
> > > > doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php on line 602
> > > >
> > > >
> > > > Doctrine version (from composer.lock):
> > > >
> > > > "name": "doctrine/dbal",
> > > > "version": "v2.4.2",
> > > >
> > > > Symfony 2.4.1 (If that's of any interest)
> > > >
> > > > So, is this just the stupid and wrong way to query or a bug?
> > > >
> > > > Doing (well, close) this in SQL gives 0 rows and no error.
> > > >
> > > >
> > > > Thomas.
> > > >
> > > > --
> > > > You received this message because you are subscribed to the Google
> > Groups
> > > > "doctrine-user" group.
> > > > To unsubscribe from this group and stop receiving emails from it, send
> > an
> > > > email to [email protected].
> > > > To post to this group, send email to [email protected].
> > > > Visit this group at http://groups.google.com/group/doctrine-user.
> > > > For more options, visit https://groups.google.com/groups/opt_out.
> > > >
> > >
> > > --
> > > You received this message because you are subscribed to the Google
> > Groups "doctrine-user" group.
> > > To unsubscribe from this group and stop receiving emails from it, send
> > an email to [email protected].
> > > To post to this group, send email to [email protected].
> > > Visit this group at http://groups.google.com/group/doctrine-user.
> > > For more options, visit https://groups.google.com/groups/opt_out.
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "doctrine-user" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to [email protected].
> > To post to this group, send email to [email protected].
> > Visit this group at http://groups.google.com/group/doctrine-user.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "doctrine-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/groups/opt_out.
Query created
PHP Warning: Illegal offset type in
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php on line 601
PHP Stack trace:
PHP 1. {main}() Symfony/web/app_dev.php:0
PHP 2. Symfony\\Component\\HttpKernel\\Kernel->handle()
Symfony/web/app_dev.php:30
PHP 3.
Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle()
Symfony/app/bootstrap.php.cache:2303
PHP 4. Symfony\\Component\\HttpKernel\\HttpKernel->handle()
Symfony/app/bootstrap.php.cache:3022
PHP 5. Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
Symfony/app/bootstrap.php.cache:2883
PHP 6. call_user_func_array() Symfony/app/bootstrap.php.cache:2911
PHP 7.
NTE\\InventoryBundle\\Controller\\ItemFunctionController->showConfigAction()
Symfony/app/bootstrap.php.cache:2911
PHP 8.
NTE\\InventoryBundle\\Entity\\ModelRepository->findModelsWithItemFunctions()
Symfony/src/NTE/InventoryBundle/Controller/ItemFunctionController.php:318
PHP 9. Doctrine\\ORM\\AbstractQuery->getResult()
Symfony/src/NTE/InventoryBundle/Entity/ModelRepository.php:126
PHP 10. Doctrine\\ORM\\AbstractQuery->execute()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:574
PHP 11. Doctrine\\ORM\\Query->_doExecute()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:794
PHP 12. Doctrine\\ORM\\Query->_parse()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:267
PHP 13. Doctrine\\ORM\\Query\\Parser->parse()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:255
PHP 14. Doctrine\\ORM\\Query\\SqlWalker->getExecutor()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:390
PHP 15. Doctrine\\ORM\\Query\\Exec\\SingleSelectExecutor->__construct()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:278
PHP 16. Doctrine\\ORM\\Query\\SqlWalker->walkSelectStatement()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php:42
PHP 17. Doctrine\\ORM\\Query\\SqlWalker->walkWhereClause()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:522
PHP 18. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1719
PHP 19. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalTerm()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1761
PHP 20. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalFactor()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1775
PHP 21. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalPrimary()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1789
PHP 22. Doctrine\\ORM\\Query\\AST\\InExpression->dispatch()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1799
PHP 23. Doctrine\\ORM\\Query\\SqlWalker->walkInExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/AST/InExpression.php:65
PHP 24. Doctrine\\ORM\\Query\\SqlWalker->walkSubselect()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1967
PHP 25. Doctrine\\ORM\\Query\\SqlWalker->walkSimpleSelectClause()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1419
PHP 26. Doctrine\\ORM\\Query\\SqlWalker->walkSimpleSelectExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1463
PHP 27. Doctrine\\ORM\\Query\\SqlWalker->walkEntityIdentificationVariable()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1585
PHP Fatal error: Call to a member function getTableName() on a non-object in
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php on line 602
PHP Stack trace:
PHP 1. {main}() Symfony/web/app_dev.php:0
PHP 2. Symfony\\Component\\HttpKernel\\Kernel->handle()
Symfony/web/app_dev.php:30
PHP 3.
Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel->handle()
Symfony/app/bootstrap.php.cache:2303
PHP 4. Symfony\\Component\\HttpKernel\\HttpKernel->handle()
Symfony/app/bootstrap.php.cache:3022
PHP 5. Symfony\\Component\\HttpKernel\\HttpKernel->handleRaw()
Symfony/app/bootstrap.php.cache:2883
PHP 6. call_user_func_array() Symfony/app/bootstrap.php.cache:2911
PHP 7.
NTE\\InventoryBundle\\Controller\\ItemFunctionController->showConfigAction()
Symfony/app/bootstrap.php.cache:2911
PHP 8.
NTE\\InventoryBundle\\Entity\\ModelRepository->findModelsWithItemFunctions()
Symfony/src/NTE/InventoryBundle/Controller/ItemFunctionController.php:318
PHP 9. Doctrine\\ORM\\AbstractQuery->getResult()
Symfony/src/NTE/InventoryBundle/Entity/ModelRepository.php:126
PHP 10. Doctrine\\ORM\\AbstractQuery->execute()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:574
PHP 11. Doctrine\\ORM\\Query->_doExecute()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/AbstractQuery.php:794
PHP 12. Doctrine\\ORM\\Query->_parse()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:267
PHP 13. Doctrine\\ORM\\Query\\Parser->parse()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query.php:255
PHP 14. Doctrine\\ORM\\Query\\SqlWalker->getExecutor()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Parser.php:390
PHP 15. Doctrine\\ORM\\Query\\Exec\\SingleSelectExecutor->__construct()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:278
PHP 16. Doctrine\\ORM\\Query\\SqlWalker->walkSelectStatement()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/Exec/SingleSelectExecutor.php:42
PHP 17. Doctrine\\ORM\\Query\\SqlWalker->walkWhereClause()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:522
PHP 18. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1719
PHP 19. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalTerm()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1761
PHP 20. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalFactor()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1775
PHP 21. Doctrine\\ORM\\Query\\SqlWalker->walkConditionalPrimary()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1789
PHP 22. Doctrine\\ORM\\Query\\AST\\InExpression->dispatch()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1799
PHP 23. Doctrine\\ORM\\Query\\SqlWalker->walkInExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/AST/InExpression.php:65
PHP 24. Doctrine\\ORM\\Query\\SqlWalker->walkSubselect()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1967
PHP 25. Doctrine\\ORM\\Query\\SqlWalker->walkSimpleSelectClause()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1419
PHP 26. Doctrine\\ORM\\Query\\SqlWalker->walkSimpleSelectExpression()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1463
PHP 27. Doctrine\\ORM\\Query\\SqlWalker->walkEntityIdentificationVariable()
Symfony/vendor/doctrine/orm/lib/Doctrine/ORM/Query/SqlWalker.php:1585