We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A simple query builder or DQL statement like the following:
return $this->createQueryBuilder('t') ->select( 'NEW App\Dto\MainDto( NEW App\Dto\NestedDto(t.field), NEW App\Dto\NestedDto(t.field) )' ) ->getQuery() ->getResult();
fails with error:
Warning: Undefined array key "class"
If we change the first argument to let's say a string, so:
return $this->createQueryBuilder('t') ->select( 'NEW App\Dto\MainDto( t.field, NEW App\Dto\NestedDto(t.field), NEW App\Dto\NestedDto(t.field) )' ) ->getQuery() ->getResult();
then the query works.
Having a select with a single NEW DTO with only DTO arguments fails.
The query works fine.
It has something to do with ObjectHydrator::hydrateRowData() and more specifically AbstractHydrator::gatherRowData() at the following part:
ObjectHydrator::hydrateRowData()
AbstractHydrator::gatherRowData()
foreach ($this->resultSetMapping()->nestedNewObjectArguments as $objIndex => ['ownerIndex' => $ownerIndex, 'argIndex' => $argIndex]) { if (! isset($rowData['newObjects'][$ownerIndex . ':' . $argIndex])) { continue; } $newObject = $rowData['newObjects'][$ownerIndex . ':' . $argIndex]; unset($rowData['newObjects'][$ownerIndex . ':' . $argIndex]); $obj = $newObject['class']->newInstanceArgs($newObject['args']); $rowData['newObjects'][$ownerIndex]['args'][$argIndex] = $obj; } foreach ($rowData['newObjects'] as $objIndex => $newObject) { $obj = $newObject['class']->newInstanceArgs($newObject['args']); $rowData['newObjects'][$objIndex]['obj'] = $obj; }
The last $newObject['class'] doesn't exist.
$newObject['class']
It could be that this is fixed in #11825
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report
Summary
A simple query builder or DQL statement like the following:
fails with error:
If we change the first argument to let's say a string, so:
then the query works.
Current behavior
Having a select with a single NEW DTO with only DTO arguments fails.
Expected behavior
The query works fine.
How to reproduce
It has something to do with
ObjectHydrator::hydrateRowData()
and more specificallyAbstractHydrator::gatherRowData()
at the following part:The last
$newObject['class']
doesn't exist.It could be that this is fixed in #11825
The text was updated successfully, but these errors were encountered: