1: why the table alias is 'i' instead of 'p'?
2: why 'num_a' is that the sentence is not replaced by 'i__0', how to fix it?
Both questions simply answer: Doctrine uses its own aliases for the request. You do not need to know these aliases, as they will not affect you, and you will not have to work with it.
Despite the fact that Doctrine calls the alias i__0 , you can access this attribute using your custom alias, for example. $yourObject->num_a will have the correct value, namely the result of count(p.product_id) .
To see that the result of your query is a useful debugging function, but relying on the inside of your application does not make sense, since these values ββare used only for Doctrine's internal mechanisms.
Drcolosos
source share