我的联接查询:(在实体中不是关系)
$query = $this
->createQueryBuilder('f')
->select('f');
$query->leftJoin(IntranetType::class,'it','WITH','it.flyerLayoutType = f.flyerLayout');
$query->addSelect('it');
$query->orderBy('f.filename');
$query->addOrderBy('it.flyerLayoutType');
// $flyers = $query->getQuery()->getarrayResult(); <-- fist try
$flyers = $query->getQuery()->getResult(Query::HYDRATE_ARRAY);
结果数组的格式为:
array(149) {
[0]=>
array(9) {
data from table with alias f
}
[1]=>
array(4) {
data from table with alias it
}
[2]=>
array(9) {
data from table with alias f
}
[3]=>
array(4) {
data from table with alias it
}
但是我需要这样的格式:
array(149) {
[0]=>
array(9) {
data from table with alias f
['joined table']=>
array(4) {
data from table with alias it
}
}
[1]=>
array(9) {
data from table with alias f
['joined table']=>
array(4) {
data from table with alias it
}
}
只是层次结构...数组中的一键=一张传单(一件),并且具有连接的数据...