Hi Hamo, This has been discussed multiple times in the past and it won't be fixed for now: http://www.doctrine-project.org/jira/browse/DDC-16
I provided a temporary solution at http://stackoverflow.com/questions/14851602/where-ing-in-discriminated-tables/14854067(shouldn't be a problem in your case, since you seem to be ignoring indexes in your query anyway). This may be improved in future D2 versions, but it is out of question in short-term releases. Cheers, Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On 15 March 2014 04:20, Hamo <[email protected]> wrote: > I have also tried the following query and it also fails: > > SELECT c FROM Car c LEFT JOIN e.carParts p WHERE LOWER(c.brand) LIKE > :query OR (p INSTANCE OF EnginePart AND LOWER(p.engineNumber) LIKE :query) > > > On Friday, March 14, 2014 9:51:29 PM UTC-5, Hamo wrote: >> >> Hi, >> >> I have a fairly straight forward inheritance hierarchy that I am try to >> query. The essentials are as follows: >> >> A Car has OneToMany CarPart. >> CarPart canBe an EnginePart or a BobyPart. >> A Car has a *brand*. >> An EnginePart has an *engineNumber*. >> A BodyPart has a *panelNumber*. >> >> 'canBe' is intended to express inverse of an isA relationship. i.e. >> EnginePart and BodyPart inherit from CarPart >> >> I am trying to find all Cars with their *brand *LIKE a *:query *OR if >> they have an EnginePart with an *engineNumber *LIKE a *:query*. >> >> Through the query builder API, I have created the following DQL statement: >> SELECT c FROM Car c LEFT JOIN e.carParts p WITH TYPE(p) >> = EnginePart WHERE LOWER(c.brand) LIKE :query OR LOWER(p.engineNumber) LIKE >> :query >> >> When I try to execute this query, I get the following error: >> >> [Semantical Error] line 0, col 113 near 'engineNumber) LIKE ': Error: >> Class CarPart has no field or association named engineNumber >> >> This seems like a bug in the semantics validator not recognising the type >> guard. >> >> Please any comments are welcomed >> >> >> -- > 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.
