public function testManyByArray()
 {
     $query = new OrderByExpression();
     $query->orderBy(['id' => true, 'updated_at' => false])->andOrderBy('id', false);
     static::assertEquals('ORDER BY `id`, `updated_at` DESC, `id` DESC', $query->toSql());
     static::assertEquals([], $query->getBindings());
 }
Example #2
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;
 }