Passed
Branch v1.4.0 (4a0ecd)
by Wanderson
01:13
created

OrderTrait::newer()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Win\Database\Orm\Traits;
4
5
use Win\Database\Sql\Queries\Select;
6
7
trait OrderTrait
8
{
9
	/** @var Select */
10
	private $query;
11
12
	/**
13
	 * Ordena por um campo
14
	 * @param string $orderBy
15
	 * @return static
16
	 */
17
	public function orderBy($orderBy)
18
	{
19
		$this->query->orderBy->set($orderBy);
20
21
		return $this;
22
	}
23
24
	/**
25
	 * Ordena pelo id
26
	 * @return static
27
	 */
28
	public function order($mode = 'DESC')
29
	{
30
		$this->orderBy('id ' . $mode);
31
32
		return $this;
33
	}
34
}
35