Commit e5a95bf3 authored by guilhermeblanco's avatar guilhermeblanco

[2.0] More documentation and fixes to QueryBuilder and Expr classes.

parent 3d17cb0d
...@@ -53,11 +53,6 @@ class Expr ...@@ -53,11 +53,6 @@ class Expr
return new Expr\From($from, $alias); return new Expr\From($from, $alias);
} }
public static function join($joinType, $join, $alias = null, $conditionType = null, $condition = null)
{
return new Expr\Join($joinType, $join, $alias, $conditionType, $condition);
}
public static function leftJoin($join, $alias = null, $conditionType = null, $condition = null) public static function leftJoin($join, $alias = null, $conditionType = null, $condition = null)
{ {
return new Expr\Join(Expr\Join::LEFT_JOIN, $join, $alias, $conditionType, $condition); return new Expr\Join(Expr\Join::LEFT_JOIN, $join, $alias, $conditionType, $condition);
......
...@@ -42,7 +42,7 @@ abstract class Base ...@@ -42,7 +42,7 @@ abstract class Base
public function __construct($args = array()) public function __construct($args = array())
{ {
foreach ($args as $arg) { foreach ((array) $args as $arg) {
$this->add($arg); $this->add($arg);
} }
} }
......
...@@ -259,19 +259,11 @@ class QueryBuilder ...@@ -259,19 +259,11 @@ class QueryBuilder
public function innerJoin($join, $alias = null, $conditionType = null, $condition = null) public function innerJoin($join, $alias = null, $conditionType = null, $condition = null)
{ {
/*$join = 'INNER JOIN ' . $parentAlias . '.' . $join . ' '
. $alias . (isset($condition) ? ' ' . $condition : null);
return $this->add('from', $join, true);*/
return $this->add('from', Expr::innerJoin($join, $alias, $conditionType, $condition), true); return $this->add('from', Expr::innerJoin($join, $alias, $conditionType, $condition), true);
} }
public function leftJoin($join, $alias = null, $conditionType = null, $condition = null) public function leftJoin($join, $alias = null, $conditionType = null, $condition = null)
{ {
/*$join = 'LEFT JOIN ' . $parentAlias . '.' . $join . ' '
. $alias . (isset($condition) ? ' ' . $condition : null);
return $this->add('from', $join, true);*/
return $this->add('from', Expr::leftJoin($join, $alias, $conditionType, $condition), true); return $this->add('from', Expr::leftJoin($join, $alias, $conditionType, $condition), true);
} }
...@@ -310,7 +302,7 @@ class QueryBuilder ...@@ -310,7 +302,7 @@ class QueryBuilder
return $this->add('where', Expr::in($expr, $params), true); return $this->add('where', Expr::in($expr, $params), true);
} }
public function orWhereIn($expr, $params = array(), $not = false) public function orWhereIn($expr, $params = array())
{ {
if (count($this->_getDqlQueryPart('where')) > 0) { if (count($this->_getDqlQueryPart('where')) > 0) {
$this->add('where', 'OR', true); $this->add('where', 'OR', true);
...@@ -370,12 +362,12 @@ class QueryBuilder ...@@ -370,12 +362,12 @@ class QueryBuilder
return $this->add('having', Expr::having($having), true); return $this->add('having', Expr::having($having), true);
} }
public function orderBy($sort, $order) public function orderBy($sort, $order = null)
{ {
return $this->add('orderBy', Expr::orderBy($sort, $order), false); return $this->add('orderBy', Expr::orderBy($sort, $order), false);
} }
public function addOrderBy($sort, $order) public function addOrderBy($sort, $order = null)
{ {
return $this->add('orderBy', Expr::orderBy($sort, $order), true); return $this->add('orderBy', Expr::orderBy($sort, $order), true);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment