I would probably use `git blame` on that piece of code to find out what the
edge cases are there: don't think anybody really remembers the specific.

In general, SQL generated for an inheritance tree should only contain
filtering for common fields, and never child class fields as per
discussions in https://github.com/doctrine/doctrine2/issues/2237

Marco Pivetta

http://twitter.com/Ocramius

http://ocramius.github.com/

On Thu, Jan 5, 2017 at 11:41 AM, Lukas Hofer <[email protected]> wrote:

> Hi! I have the following structure of entities: Customer is the parent
> class and it has two subclasses - Company and Person. My problem is that I
> need to apply filters to specific fields in Company and Person, not just
> Customer. As an example: Company is filtered by Company.name and Person is
> filtered by Person.FirstName OR Person.LastName. As far as I can see there
> is just no way to do this in Doctrine? The $targetEntity the filter gets
> passed is always the root entity. In SqlWalker::generateFilterConditionSQL
> the following snippet can be found:
>
>
> if ($targetEntity->name !== $targetEntity->rootEntityName) {
>     return '';
> }
>
>
> Are there any specific reasons for this? The documentation states
>
>
> In the case of joined or single table inheritance, you always get passed
>> the ClassMetadata of the inheritance root. This is necessary to avoid edge
>> cases that would break the SQL when applying the filters.
>
>
> What are those edge cases? It seems pretty straight forward to me - "Is
> this the class we want to filter? yes -> add (....) to the WHERE part".
> Could I extend the SqlWalker to remove this limitation? I don't use much
> inheritance so edge cases don't seem to be a problem for me? Or is there a
> more elegant way to do this?
>
> --
> 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.
>

-- 
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