11# Orderly
22
3- [ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/UseMuffin/Orderly/ci.yml?style=flat-square&branch=master )] ( https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster )
3+ [ ![ Build Status] ( https://img.shields.io/github/actions/workflow/status/UseMuffin/Orderly/ci.yml?branch=master& style=flat-square )] ( https://github.com/UseMuffin/Orderly/actions/workflows/ci.yml?query=branch%3Amaster )
44[ ![ Coverage] (https://img.shields.io/codecov/c/github/UseMuffin/Orderly/master?style=flat-square
55)] ( https://app.codecov.io/gh/UseMuffin/Orderly )
66[ ![ Total Downloads] ( https://img.shields.io/packagist/dt/muffin/orderly.svg?style=flat-square )] ( https://packagist.org/packages/muffin/orderly )
@@ -12,13 +12,13 @@ Allows setting default order for your tables.
1212
1313Using [ Composer] [ composer ] :
1414
15- ```
15+ ``` sh
1616composer require muffin/orderly
1717```
1818
1919Then load the plugin using the console command:
2020
21- ```
21+ ``` sh
2222bin/cake plugin load Muffin/Orderly
2323```
2424
@@ -38,7 +38,7 @@ $this->addBehavior('Muffin/Orderly.Orderly');
3838$this->addBehavior('Muffin/Orderly.Orderly', ['order' => $this->aliasField('field_name')]);
3939```
4040
41- Value for ` order ` key can any valid value that ` \Cake\ORM\Query::orderBy() ` takes.
41+ Value for ` order ` key can any valid value that ` \Cake\ORM\Query\SelectQuery ::orderBy() ` takes.
4242The default order clause will only be applied to the primary query and when no
4343custom order clause has already been set for the query.
4444
@@ -48,7 +48,7 @@ condition using `callback` option. The order will be applied if callback returns
4848``` php
4949$this->addBehavior('Muffin/Orderly.Orderly', [
5050 'order' => ['Alias.field_name' => 'DESC'],
51- 'callback' => function (\Cake\ORM\Query $query, \ ArrayObject $options, bool $primary) {
51+ 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
5252 //return a boolean
5353 }
5454]);
@@ -61,13 +61,13 @@ on return value of their respective callbacks:
6161$this->addBehavior('Muffin/Orderly.Orderly', [
6262 [
6363 'order' => ['Alias.field_name' => 'DESC'],
64- 'callback' => function (\Cake\ORM\Query $query, \ ArrayObject $options, bool $primary) {
64+ 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
6565 //return a boolean
6666 }
6767 ],
6868 [
6969 'order' => ['Alias.another_field'],
70- 'callback' => function (\Cake\ORM\Query $query, \ ArrayObject $options, bool $primary) {
70+ 'callback' => function (SelectQuery $query, ArrayObject $options, bool $primary) {
7171 //return a boolean
7272 }
7373 ],
0 commit comments