You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- The `unique_together_fields` property is only applicable when the `many` property is set to `true`.
233
233
- The fields defined in the `unique_together_fields` property must be defined in the Model's Field objects.
234
234
235
-
### sort_by_field
235
+
### sort_by
236
236
237
-
The `sort_by_field` property is used to define the field that objects of the Model will be sorted by. When this property is
238
-
set, objects created and updated will be sorted according to the assigned field using the assigned `sort_option`.
237
+
The `sort_by` property is used to define the fields that objects of the Model will be sorted by. When this property is
238
+
set, objects created and updated will be sorted according to the assigned field using the assigned `sort_order`.
239
239
240
240
Example:
241
241
242
242
```php
243
-
$this->sort_by_field = 'name';
243
+
$this->sort_by = ['name'];
244
244
```
245
245
246
246
!!! Warning
247
247
The use of sorting in a Model may cause IDs to be re-ordered when objects are created or updated.
248
248
!!! Notes
249
-
- The `sort_by_field` property is only applicable when the `many` property is set to `true`.
250
-
- The field defined in the `sort_by_field` property must be defined in the Model's Field objects.
249
+
- The `sort_by` property is only applicable when the `many` property is set to `true`.
250
+
- The field defined in the `sort_by` property must be defined in the Model's Field objects.
251
251
252
-
### sort_option
252
+
### sort_order
253
253
254
-
The `sort_option` property is used to define the PHP sorting option for objects of the Model. When this property is set,
254
+
The `sort_order` property is used to define the PHP sorting option for objects of the Model. When this property is set,
255
255
objects created and updated will be sorted according to the assigned option. For valid sorting options, refer to: For valid value options for this property, refer to the
256
256
[PHP multi-sort function type flags](https://www.php.net/manual/en/function.array-multisort.php).
257
257
258
258
Example:
259
259
260
260
```php
261
-
$this->sort_option = SORT_ASC;
261
+
$this->sort_order = SORT_ASC;
262
262
```
263
263
264
264
!!! Warning
265
265
The use of sorting in a Model may cause IDs to be re-ordered when objects are created or updated.
266
266
!!! Notes
267
-
- The `sort_option` property is only applicable when the `many` property is set to `true`.
268
-
- The `sort_option` property is only applicable when a `sort_by_field` is defined.
267
+
- The `sort_order` property is only applicable when the `many` property is set to `true`.
268
+
- The `sort_order` property is only applicable when a `sort_by` is defined.
Copy file name to clipboardExpand all lines: docs/COMMON_CONTROL_PARAMETERS.md
+30-3Lines changed: 30 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,7 @@ parameters you can use:
34
34
immediately.
35
35
36
36
!!! Tip
37
-
The [Swagger documentation](./SWAGGER_AND_OPENAPI.md#swagger-documentation) will indicate if an endpoint applies
37
+
The [Swagger documentation](SWAGGER_AND_OPENAPI.md#swagger-documentation) will indicate if an endpoint applies
38
38
changes immediately or requires a separate apply call. If an endpoint applies changes immediately, this parameter
39
39
will have no effect.
40
40
@@ -75,6 +75,16 @@ parameters you can use:
75
75
submitted in your request will be removed from the existing array values. This is useful when you want to remove
76
76
specific values from an array field without needing to retrieve the existing values first.
77
77
78
+
!!! Warning
79
+
If you set this parameter to `true`, it will apply to all array fields. You can't choose to remove to some array
80
+
fields and replace others at the same time. To work around this, first make a request with the data for the fields
81
+
you want to remove from. Then, make another request for the fields you want to replace.
82
+
83
+
!!! Notes
84
+
- This parameter is only available for `PATCH` requests.
85
+
- This parameter is only applicable to array fields.
86
+
- If the submitted array values match the existing array values exactly, the API will not make any changes to that field to avoid removing all values unintentionally.
87
+
78
88
## reverse
79
89
80
90
- Type: Boolean
@@ -84,5 +94,22 @@ parameters you can use:
84
94
looking for an object near the end of the list. Additionally, it is helpful for time-sorted objects, such as logs,
85
95
where you may want to view the most recent entries first.
86
96
87
-
!!! Note
88
-
This parameter is only available for `GET` requests to [plural endpoints](ENDPOINT_TYPES.md#plural-many-endpoints).
97
+
## sort_by
98
+
99
+
- Type: String or Array
100
+
- Default: _Defaults to the primary sort attribute for the endpoint, typically `null`._
101
+
- Description: This parameters allows you to select the fields to use to sort the objects related to the endpoint. The
102
+
behavior of this parameter varies based on the request method and endpoint type. Refer to the
103
+
[Sorting](QUERIES_FILTERS_AND_SORTING.md#sorting) section for more information.
104
+
105
+
## sort_order
106
+
107
+
- Type: String
108
+
- Default: `SORT_ASC`
109
+
- Choices:
110
+
-`SORT_ASC`
111
+
-`SORT_DESC`
112
+
- Description: This parameter allows you to control the order in which the objects are sorted. The default value is
113
+
`SORT_ASC` which sorts the objects in ascending order. Setting this parameter to `SORT_DESC` will sort the objects in
114
+
descending order. The behavior of this parameter varies based on the request method and endpoint type. Refer to the
115
+
[Sorting](QUERIES_FILTERS_AND_SORTING.md#sorting) section for more information.
0 commit comments