lithium\data\model\Query::order PHP 메소드

order() 공개 메소드

Set and get method for the query's order specification.
public order ( array | string | null $order = null ) : array | lithium\data\Query
$order array | string | null
리턴 array | lithium\data\Query
    public function order($order = null)
    {
        if ($order) {
            $this->_config['order'] = $order;
            return $this;
        }
        return $this->_config['order'];
    }

Usage Example

예제 #1
0
파일: QueryTest.php 프로젝트: EHER/chegamos
 public function testOrder()
 {
     $query = new Query($this->_queryArr);
     $expected = 'created DESC';
     $result = $query->order();
     $this->assertEqual($expected, $result);
     $query->order('updated ASC');
     $expected = 'updated ASC';
     $result = $query->order();
     $this->assertEqual($expected, $result);
 }