Beispiel #1
0
 public function testFromString()
 {
     $this->assertEquals(new \r8\Query\Expr\Ordered(new \r8\Query\Atom\Field("fld"), "ASC"), \r8\Query\Expr\Ordered::fromString("fld ASC"));
     $this->assertEquals(new \r8\Query\Expr\Ordered(new \r8\Query\Atom\Field("fld")), \r8\Query\Expr\Ordered::fromString("fld"));
     $this->assertEquals(new \r8\Query\Expr\Ordered(new \r8\Query\Atom\Field("fld", "db"), "DESC"), \r8\Query\Expr\Ordered::fromString("db.fld DESC"));
     $this->assertEquals(new \r8\Query\Expr\Ordered(new \r8\Query\Atom\Field("fld", "db"), "desc"), \r8\Query\Expr\Ordered::fromString("`db`.`fld` desc"));
 }
Beispiel #2
0
 /**
  * Adds multiple "Group By" fields at once using a fluent interface
  *
  * @param \r8\Query\iface\Ordered $fields... Any fields to add.
  *      This can be a string or an ordered object
  * @return \r8\Query\Select Returns a self reference
  */
 public function groupBy()
 {
     foreach (func_get_args() as $arg) {
         // If they didn't give us an object, create one
         if (!$arg instanceof \r8\iface\Query\Ordered) {
             $arg = \r8\Query\Expr\Ordered::fromString($arg);
         }
         $this->addGroup($arg);
     }
     return $this;
 }