Assume the following AbstractPage model:
/* * @ORM\Entity * @ORM\Table(name="page") * @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="type", type="string") * @ORM\DiscriminatorMap * ({ * "page" = "Page", * "link" = "Link" * }) */
And the following DQL query:
SELECT p FROM \Page\Model\AbstractPage
The generated SQL will be:
SELECT ... FROM page p0_ WHERE p0_.type IN ('page', 'link')
Now to the question: how can I remove the WHERE from this query. In more complex queries, this part of the WHERE does not allow the use of specific indexes that are defined. This can be resolved by adding type to the indexes, but it makes my indexes large, and I think this is optional.
AbstractPage is the root in the inheritance tree. Thus, we are interested in ALL entries in the table. Lowering the WHERE part does just that.
So the question is: how can I get Doctrine to remove this part of WHERE where it is not needed.
Thanks!
source share