I want to be able to get requested fields of entity via REST API,
including the associated field.
Like i request /api/employee?fields=position and I get only data of this
associated field (id, name) or multimple associated fields, or
associated fields + entity fields in one nice object, like the Doctrine2
gives me if I guery for the entity. Can't firuge out how to do this.
2014-12-03 11:28, 'Jasper N. Brouwer' via doctrine-user rašė:
Then you'll need to select a root alias ;)
I'm guessing it is `u`.
PS: As a side question, why are you building your query according to mapping
metadata? Are you not in control of what associations are mapped?
--
Jasper N. Brouwer
(@jaspernbrouwer)
On 3 December 2014 at 10:11:51, Andrius Kulbis ([email protected]) wrote:
This gives me the following error
Cannot select entity through identification variables without choosing at
least one root entity alias.
2014 m. gruodis 3 d., trečiadienis 11:04:18 UTC+2, Jàπ (Jasper N. Brouwer)
rašė:
You'll probably need to use a regular join, as the associations are
mapped. Maybe something like this:
foreach ($this->assoc as $key => $mapping) {
$queryBuilder
->addSelect(substr($key, 0, 1) . ' AS ' . $key)
->leftJoin(
'u.' . $mapping['fieldName'],
substr($key, 0, 1)
);
}
--
Pagarbiai
Andrius Kulbis
--
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.