Ok, thanks for the tips ;) I will try to create the tests next week!

Il giorno venerdì 5 dicembre 2014 11:51:02 UTC+1, Marco Pivetta ha scritto:
>
> Fork the project on github, checkout `master`, checkout a new branch from 
> there, add the tests and push it to your fork.
>
> Then you can open a pull-request with that branch (against `master`) from 
> the github UI :-)
>
> Marco Pivetta 
>
> http://twitter.com/Ocramius      
>
> http://ocramius.github.com/
>
> On 5 December 2014 at 11:44, Stefano Angaran <[email protected] 
> <javascript:>> wrote:
>
>> I never worked on open source projects, should I fork doctrine 2.4.6 on 
>> github, create my tests and then create the pull request? Sorry for the 
>> dumb question ^^
>>
>> Il giorno venerdì 5 dicembre 2014 11:38:13 UTC+1, Marco Pivetta ha 
>> scritto:
>>>
>>> You can look at existing tests in https://github.com/doctrine/
>>> doctrine2/tree/v2.4.6/tests/Doctrine/Tests/ORM/Functional/Ticket and 
>>> submit a new pull request with a new test (test case name can have a 
>>> provisional "XXX" in the name until you get an issue ID assigned).
>>>
>>> Think you can do that?
>>>
>>> Marco Pivetta 
>>>
>>> http://twitter.com/Ocramius      
>>>
>>> http://ocramius.github.com/
>>>
>>> On 5 December 2014 at 11:35, Stefano Angaran <[email protected]> 
>>> wrote:
>>>
>>>> @Marco I think so, what's the standard procedure to it?
>>>>
>>>> Il giorno venerdì 5 dicembre 2014 11:31:18 UTC+1, Marco Pivetta ha 
>>>> scritto:
>>>>>
>>>>> This looks like a bug to me.
>>>>>
>>>>> We'd probably need to fix the DQL and/or metadata API to have the 
>>>>> subclasses stored in parent class metadata, or have all discriminator 
>>>>> mappings checked (and the inheritance re-constructed from there) in the 
>>>>> SQLWalker.
>>>>>
>>>>> @Stefano can you come up with a failing test case?
>>>>>
>>>>>
>>>>> Marco Pivetta 
>>>>>
>>>>> http://twitter.com/Ocramius      
>>>>>
>>>>> http://ocramius.github.com/
>>>>>
>>>>> On 5 December 2014 at 11:26, Stefano Angaran <[email protected]> 
>>>>> wrote:
>>>>>
>>>>>> I was looking at Doctrine SQLWalker code and that was my conclusion 
>>>>>> too.
>>>>>>
>>>>>> I think I will refactor my query code then. If I change the FROM 
>>>>>> clause to look for B items I can make it work without using instance of 
>>>>>> operator.
>>>>>>
>>>>>> My suggestion is also to better clarify this in the INSTANCE OF 
>>>>>> operator documentation stating that it should be used only to search for 
>>>>>> leaf entities, what you think?
>>>>>>
>>>>>> Il giorno venerdì 5 dicembre 2014 11:22:50 UTC+1, Jàπ (Jasper N. 
>>>>>> Brouwer) ha scritto:
>>>>>>>
>>>>>>> I think I misjudged how Doctine handles these filters :( 
>>>>>>>
>>>>>>> It seems that when filtering on "instanceof B", it will produce a 
>>>>>>> query that will search for a row with `type = B`. Because B is in fact 
>>>>>>> an 
>>>>>>> abstract class, it will never exist in the db, so the query will indeed 
>>>>>>> return an empty result set. 
>>>>>>>
>>>>>>> Seeing this in action, I think this is intended behavior, and your 
>>>>>>> use-case is unfortunately not supported. 
>>>>>>>
>>>>>>> If it would be supported, it would mean that Doctrine would have to 
>>>>>>> figure out the inheritance graph beforehand, then create a query that 
>>>>>>> will 
>>>>>>> check not only `type = B`, but every child of B as well. That would 
>>>>>>> impact 
>>>>>>> performance, which is my guess as to why this isn't supported. 
>>>>>>>
>>>>>>> I'm afraid the only solution right now is to filter on "instanceof D 
>>>>>>> or instanceof E". 
>>>>>>>
>>>>>>> PS: If your inheritance graph will get larger, it will pay of to use 
>>>>>>> composition (together with associations) in stead of inheritance. 
>>>>>>>
>>>>>>> --   
>>>>>>> Jasper N. Brouwer 
>>>>>>> (@jaspernbrouwer) 
>>>>>>>
>>>>>>>
>>>>>>> On 5 December 2014 at 10:41:15, Stefano Angaran ([email protected]) 
>>>>>>> wrote: 
>>>>>>> > Here it is. I've made some edit to reduce attributes number but 
>>>>>>> the 
>>>>>>> > structure is intact 
>>>>>>> >   
>>>>>>> > SELECT p0_.id AS id0, p0_.name AS name1, c1_.attr AS attr6, 
>>>>>>> f3_.sku AS 
>>>>>>> > sku7, c5_.foo AS foo8, c5_.bar AS bar9, p0_.type AS type12 FROM A 
>>>>>>> p0_ LEFT 
>>>>>>> > JOIN C c1_ ON p0_.id = c1_.id LEFT JOIN B f3_ ON p0_.id = f3_.id 
>>>>>>> LEFT JOIN 
>>>>>>> > D f4_ ON p0_.id = f4_.id WHERE p0_.type IN ('B') 
>>>>>>> >   
>>>>>>> > Only B is added in the WHERE expression. Am I doing something 
>>>>>>> wrong or is 
>>>>>>> > it how it's supposed to work? 
>>>>>>>
>>>>>>>
>>>>>>>  -- 
>>>>>> 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.
>>>>>>
>>>>>
>>>>>  -- 
>>>> 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.
>>>>
>>>
>>>  -- 
>> 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