Availability of the following main tables (one-to-many relationship) Client. Has many users.
Users - each user belongs to one client.
In a very simple example, if I query a custom object (Querybuilder) with getArrayResult() I see the following:
- The actually generated SQL contains the foreign key field that should be (i.e. ClientID)
- The actual returned dataset does NOT contain a foreign key field.
At this stage, I do not need to return foreign data, and therefore do not need to join the linked table.
So the question is ... What and how to return the value of a foreign key in my array?
Request:
$qb = $this->_em->createQueryBuilder(); $qb->select('e'); $qb->from('Entity\User', 'e');
SQL:
SELECT w0_.Id AS Id0, w0_.Name AS Name2, w0_.ClientID AS ClientID7 FROM users w0_
php orm doctrine2
MarkOfSine
source share