Skip to content

Commit 8a15db4

Browse files
committed
add method orderBy
1 parent 872bb13 commit 8a15db4

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

src/PHPixie/ORM/Models/Type/Database/Implementation/Query.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ public function clearOffset()
8686
return $this;
8787
}
8888

89+
public function orderBy($field, $direction)
90+
{
91+
$this->orderBy[] = $this->values->orderBy($field, $direction);
92+
return $this;
93+
}
94+
8995
public function orderAscendingBy($field)
9096
{
9197
$this->orderBy[] = $this->values->orderBy($field, 'asc');

src/PHPixie/ORM/Models/Type/Database/Query.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ public function getOffset();
4040
*/
4141
public function clearOffset();
4242

43+
/**
44+
* @param $field
45+
* @param $direction
46+
*
47+
* @return static
48+
*/
49+
public function orderBy($field, $direction);
50+
4351
/**
4452
* @return static
4553
*/

src/PHPixie/ORM/Wrappers/Type/Database/Query.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,13 @@ public function clearOffset()
5555
$this->query->clearOffset();
5656
return $this;
5757
}
58-
58+
59+
public function orderBy($field, $direction)
60+
{
61+
$this->query->orderBy($field, $direction);
62+
return $this;
63+
}
64+
5965
public function orderAscendingBy($field)
6066
{
6167
$this->query->orderAscendingBy($field);

0 commit comments

Comments
 (0)