Having the follow basic tables (one-to-many relationship)
Client - Has many users.
Users - Each user belongs to single client.
In a very simple example if I query the user entity (Querybuilder)
with getArrayResult()
I see the following:
At this stage I do not need to return foreign data and so do not need to join to the associated table.
So question is...
What or how do I return the foreign key value in my array?
Query is:
$qb = $this->_em->createQueryBuilder();
$qb->select('e');
$qb->from('Entity\User', 'e');
SQL is:
SELECT w0_.Id AS Id0, w0_.Name AS Name2, w0_.ClientID AS ClientID7
FROM users w0_
Try to set the HINT_INCLUDE_META_COLUMNS
query hint on the query (not the builder) before you execute it.
$q->setHint(Query::HINT_INCLUDE_META_COLUMNS, true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With