-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
When using an Inspector with a custom query using a belongs-to relation the controller will create a query using wrong aliases resulting in a crash.
Config example:
return array(
'model' => 'Model_With_BelongsTo',
'query' => array(
'model' => 'Model_With_BelongsTo',
'related' => array('relation'),
'callback' => function ($query) {
return $query->where('relation.field', 1);
}
),
'input' => array(
'key' => 'id',
)
);Will create something similar to
SELECT COUNT(DISTINCT `t0`.`id`) AS count_result,
`t1`.`id` AS `t1_c0`,`t1`.`other_fields_from_t0` AS `t1_c1`,
`t1`.`t1_real_fields` as `t1_c2`
FROM `table_0` AS `t0`
LEFT JOIN `table_2` AS `t1` ON (`t0`.`rel_id` = `t1`.`id`)
WHERE `t0`.`id` = 1The where is executed on the wrong table and half the fields are selected on the wrong alias too.
Metadata
Metadata
Assignees
Labels
No labels