>
> The second DQL query is invalid, as you are fetch-joining and hydrating a 
> subset of the actual association.
>
 
Is it documented anywhere?

That is a logical mistake, and doctrine can't detect it nor can support it.
>
 
I think Doctrine can detect it. Well, its not trivial, but doctrine knows 
the references and can see that there are conditions for the fetch-joined 
associations, which could limit the results.

 
Am Montag, 4. August 2014 12:33:26 UTC+2 schrieb Marco Pivetta:
>
> The second DQL query is invalid, as you are fetch-joining and hydrating a 
> subset of the actual association.
>
> That is a logical mistake, and doctrine can't detect it nor can support it.
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>  
>
> On 4 August 2014 10:32, naitsirch <[email protected] <javascript:>> 
> wrote:
>
>> Some days ago I faced an issue with the filtering of child entities. I'll 
>> give you an example for easier understanding.
>> We have two entities
>>
>> |-----------|      |-----------------------------|
>> | Customer  |      | Project                     |
>> |----|------|      |------|-------------|--------|
>> | id | name |      | name | customer_id | status |
>> |----|------|      |------|-------------|--------|
>> | 1  | A    |      | P1   | 1           | 1      |
>> |----|------|      | P2   | 1           | 1      |
>>                    | P3   | 1           | 2      |
>>                    | P4   | 1           | 3      |
>>                    |------|-------------|--------|
>>                   
>> $dql1 = 'SELECT customer, project
>>          FROM Customer customer 
>>          JOIN Project project 
>>          WHERE customer.id = 1';
>>          
>> $dql2 = 'SELECT customer, project F
>>          ROM Customer customer 
>>          JOIN Project project 
>>          WHERE customer.id = 1 
>>          AND project.status = 1';
>>
>> Now if you execute both of the above queries, you will get the customer 
>> 'A' with all its projects. The second condition of $dql2 is leveraged, 
>> because Doctrine will return the same customer Object as in the first query 
>> holding the four projects. I am sure that this is a known issue and maybe 
>> you would think that possible solutions are to clear the entity manager, 
>> but this will detach all entities loaded before.
>>
>> Is there any other working solution ('REFRESH' hint could lead to 
>> dangerous side effects, so this is no solution)?
>>
>> I think Doctrine will have to care about the constitions when storing and 
>> fetching entities from the cache, but this is not trivial I think.
>>
>> What do you think?
>>
>> -- 
>> 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 http://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 http://groups.google.com/group/doctrine-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to