Hi Marco,

On Wednesday, August 23, 2017 at 9:23:33 AM UTC+2, Marco Pivetta wrote:
>
> You are filtering a fetch-joined association: that will break hydration. 
> We never manager to add error messages for this type of query, since that 
> would be a BC break, but the DQL is invalid.
>

 I realize I'm filtering here, so I'd have the following questions:

a) after the filtering I'm running the "full" query again- shouldn't that 
work independently, even more so as it actually hits the database?

b) if the filtering query per se is invalid (I think that's what you're 
saying?)- how would I properly retrieve a populated entity per joined 
filtering criteria?

c) in terms of BC- since this issue only appeared after >1 year in 
production (yikes!)- why not introduce error messages with e.g. ORM 2.6?

Much appreciated,
Andreas



> On 23 Aug 2017 9:15 AM, "Andreas Goetz" <[email protected] <javascript:>> 
> wrote:
>
> I have a simple ER diagram with entities and properties 1:n. Retrieving an 
> entity by its uuid will also obtain all it's properties:
>
> $dql = 'SELECT a, p
> FROM Volkszaehler\Model\Entity a
> LEFT JOIN a.properties p
> WHERE a.uuid = :uuid';
>
> $q = $em->createQuery($dql)
> ->setParameter('uuid', $uuid);
>
> $entity = $q->getSingleResult();
>
> var_dump($entity->getProperties()); // all properties
>
> Now, for some cases I'm identifying the entity by name (and make sure it's 
> of public type), obtain the uuid and then pass it through the above query:
>
> $dql = 'SELECT e, p
> FROM Volkszaehler\Model\Entity e
> LEFT JOIN e.properties p
> JOIN e.properties public
> WHERE p.key = :key
> AND p.value = :name
> AND public.key = :key2
> AND public.value = 1';
>
> $q = $this->em->createQuery($dql)
> ->setParameter('key', 'title')
> ->setParameter('name', $name)
> ->setParameter('key2', 'public');
>
> $entity = $q->getSingleResult();
>
> Now, calling the first query with the UUID, only a single property is 
> returned but not all of them as expected:
>
> var_dump($entity->getProperties()); // only 'title' property is shown
>
> SQL trace shows that the exact same queries are executed, only in the 2nd 
> case the properties apparently are swallowed by the ORM.
>
> Any idea what's wrong here?
>
> Thanks,
> Andreas
>
> -- 
> 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] <javascript:>.
> To post to this group, send email to [email protected] 
> <javascript:>.
> Visit this group at https://groups.google.com/group/doctrine-user.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
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 https://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to