midgardproject/midgard-core — Issue #131: QuerySelect add_order method uses invalid table alias
Author: piotras
Created: 2011-12-21 12:21:08+00:00
State: open

This code works:

$qs = new midgard_query_storage('midgard_node_property');
$q = new midgard_query_select($qs);
$qs2 = new midgard_query_storage('midgard_node_property');
$q->add_join(
'INNER',
new \midgard_query_property('id'),
new \midgard_query_property('id', $qs2)
);
$q->add_order(new midgard_query_property('id'), \SORT_ASC);

And this one, doesn't:

$qs = new midgard_query_storage('midgard_node_property');
$q = new midgard_query_select($qs);
$q->add_order(new midgard_query_property('id'), \SORT_ASC);

In second case, invalid 't2.id' is set.