Skip to content

Commit 8cac5e9

Browse files
committed
add comment
1 parent 3dc9868 commit 8cac5e9

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

lib/Relation.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,21 @@ public function joins(string|array $joins): Relation
169169
}
170170

171171
/**
172+
* Applies an ```ORDER BY``` clause to a query.
173+
*
174+
* This could be a source of SQL injection, so only strings composed of plain
175+
* column names and simple ```function(column_name)``` expressions
176+
* with optional ASC/DESC modifiers are allowed.
177+
*
178+
* User::order('name') // SELECT "users".*
179+
* // FROM "users" ORDER BY name
180+
*
181+
* User::order('name DESC') // SELECT "users".*
182+
* // FROM "users" ORDER BY name DESC
183+
*
184+
* User::order('name DESC, email') // SELECT "users".*
185+
* // FROM "users" ORDER BY name DESC, email
186+
*
172187
* @return Relation<TModel>
173188
*/
174189
public function order(string $order): Relation

0 commit comments

Comments
 (0)