So we have such dql
$oQuery = $this->createQueryBuilder('assets')
->addSelect('flags')
->addSelect('types')
->addSelect('groups')
->leftJoin('Site\MainBundle\Entity\123\invFlags', 'flags', Join::WITH, 'assets.flag = flags.flagID')
->leftJoin('Site\MainBundle\Entity\123\invTypes', 'types', Join::WITH, 'assets.typeID = types.typeID')
->leftJoin('Site\MainBundle\Entity\123\invGroups', 'groups', Join::WITH, 'types.groupID = groups.groupID');
if (!empty($aFilter)) {
$bFirst = true;
foreach ($aFilter as $sKey => $sValue) {
if ($bFirst) {
$oQuery->where($oQuery->expr()->eq('assets.' . $sKey, $sValue));
$bFirst = false;
continue;
} else {
if ($sValue === null) {
$oQuery->andWhere($oQuery->expr()->isNull('assets.' . $sKey));
}
}
}
}
return $oQuery->getQuery()->getResult();
We call it from repository and have result... BUT. In sql query ($oQuery->getQuery()->getSQL()) I see all columns and proper left join I need, but NOT in result. Why it happens? When I return '->getScalarResult()' I receive all needed data but like array and with prefix of tables
array(38) {
["assets_id"]=>string(4) "4558"
["assets_characterID"]=>string(8) "90206263"
["assets_parentItemID"]=>NULL
Can I anyhow get simple 'combined' object' with all get methods?
ADD: Forgot to say that there are no relations in entities.