Hi Thomas,

About the validation, I was explicitly asking for the ouput of the
`orm:validate-schema` CLI command.

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?

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.

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.

Reply via email to