I am working on a query for two tables that do not have fk defined or orm relation but they are actually related. Example:
tableA: id, value
ROWS ((1, test), (2, test2))
tableB: id, tableA_id, value
ROWS ((1, 1, testIt))
I need to join them with doctrine and get the value of both tableA and tableB.
Currently i get
[
ObjectA(id=1),
ObjectB(id=1),
ObjectA2(id=2),
null
]
With DQL:
$queryBuilder
->select('ta')
->addSelect('tb')
->innerJoin(TableB::class, 'tableB', Join::WITH,
'ta.id = tb.tableAId')
->getQuery()->getResult();
I need (not set in stone, need it do be grouped by join):
[
[ObjectA(id=1), ObjectB(id=1)],
[ObjectA(id=2)]
]