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
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)
{
return new Expr\Join(Expr\Join::LEFT_JOIN, $join, $alias, $conditionType, $condition);
......
......@@ -42,7 +42,7 @@ abstract class Base
public function __construct($args = array())
{
foreach ($args as $arg) {
foreach ((array) $args as $arg) {
$this->add($arg);
}
}
......
......@@ -259,19 +259,11 @@ class QueryBuilder
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);
}
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);
}
......@@ -310,7 +302,7 @@ class QueryBuilder
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) {
$this->add('where', 'OR', true);
......@@ -370,12 +362,12 @@ class QueryBuilder
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);
}
public function addOrderBy($sort, $order)
public function addOrderBy($sort, $order = null)
{
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