if (isset($tables[$table_name]['condition'
])) { $tables[$table_name]['condition'
] =
$this->
conditionNamespace($tables[$table_name]['condition'
]);
} } // Namespace fields.
foreach (array_keys($fields) as $field_name) { $fields[$field_name]['table'
] .=
$this->subquery_namespace;
$fields[$field_name]['alias'
] .=
$this->subquery_namespace;
} // Namespace conditions.
$where = &
$subquery->
conditions();
$this->
alterSubqueryCondition($subquery,
$where);
// Not sure why, but our sort order clause doesn't have a table.
// TODO: the call to addHandler() above to add the sort handler is probably
// wrong -- needs attention from someone who understands it.
// In the meantime, this works, but with a leap of faith.
$orders = &
$subquery->
getOrderBy();
foreach ($orders as $order_key =>
$order) { // But if we're using a whole view, we don't know what we have!
if ($options['subquery_view'
]) { [$sort_table,
$sort_field] =
explode('.',
$order_key);
} $orders[$sort_table .
$this->subquery_namespace . '.' .
$sort_field] =
$order;