示例#1
0
 /**
  * @param array|string $name
  * @param boolean $asc
  * @return static
  */
 public function andOrderBy($name, $asc = true)
 {
     if (!isset($this->orderBy)) {
         $this->orderBy = new OrderByExpression();
     }
     $this->orderBy->andOrderBy($name, $asc);
     return $this;
 }
示例#2
0
 public function testAndOrderByOnlyOne()
 {
     $query = new OrderByExpression();
     $query->andOrderBy('id');
     static::assertEquals('ORDER BY `id`', $query->toSql());
     static::assertEquals([], $query->getBindings());
     $query = new OrderByExpression();
     $query->andOrderBy('id', true);
     static::assertEquals('ORDER BY `id`', $query->toSql());
     static::assertEquals([], $query->getBindings());
     $query = new OrderByExpression();
     $query->andOrderBy('id', false);
     static::assertEquals('ORDER BY `id` DESC', $query->toSql());
     static::assertEquals([], $query->getBindings());
 }