summaryrefslogtreecommitdiff
path: root/fai_gestion/plugins/CustomTheme/src/Template/Bake
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-22 22:33:53 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-07-22 22:33:53 +0200
commitb9451ccf0ed90c674c6f714de10a71a33a6c7b16 (patch)
tree32c0802d0f6c90f5d1df1b1978bf8b582b7ac407 /fai_gestion/plugins/CustomTheme/src/Template/Bake
parent32998439f320ad0b36f91b7e508f8039ee0caa95 (diff)
downloadchd_gestion-b9451ccf0ed90c674c6f714de10a71a33a6c7b16.zip
chd_gestion-b9451ccf0ed90c674c6f714de10a71a33a6c7b16.tar.gz
chd_gestion-b9451ccf0ed90c674c6f714de10a71a33a6c7b16.tar.bz2
bake: allow default order by through associated tables
Diffstat (limited to 'fai_gestion/plugins/CustomTheme/src/Template/Bake')
-rw-r--r--fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig8
1 files changed, 6 insertions, 2 deletions
diff --git a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig
index 788e48f..c4a158c 100644
--- a/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig
+++ b/fai_gestion/plugins/CustomTheme/src/Template/Bake/Model/table.twig
@@ -185,10 +185,14 @@ class {{ name }}Table extends Table
*/
public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
{
-{%- if BakeExtra.hasOrderOpts(name) %}
-
+{% if BakeExtra.hasOrderOpts(name) %}
$order = $query->clause('order');
if ($order === null || !count($order)) {
+{% if BakeExtra.hasOrderContains(name) %}
+ $query->contain([
+ {{- Bake.stringifyList(BakeExtra.getOrderContains(name), {'indent': 4})|raw -}}
+ ]);
+{% endif %}
$query->order([
{{- Bake.stringifyList(BakeExtra.getOrderOpts(name), {'indent': 4})|raw -}}
]);