refactored and prettified the default database grammar.

This commit is contained in:
Taylor Otwell
2011-10-11 22:45:19 -05:00
parent 08ea1dbbc8
commit 8846110e8d
2 changed files with 86 additions and 30 deletions

View File

@@ -250,7 +250,12 @@ class Query {
*/
public function where_in($column, $values, $connector = 'AND', $not = false)
{
$this->wheres[] = array_merge(array('type' => 'where_in'), compact('column', 'values', 'connector', 'not'));
// The type set in this method will be used by the query grammar to call the
// appropriate compiler function for the where clause. For cleanliness, the
// compiler for "not in" and "in" statements is broken into two functions.
$type = ($not) ? 'where_not_in' : 'where_in';
$this->wheres[] = compact('type', 'column', 'values', 'connector');
$this->bindings = array_merge($this->bindings, $values);
@@ -304,7 +309,12 @@ class Query {
*/
public function where_null($column, $connector = 'AND', $not = false)
{
$this->wheres[] = array_merge(array('type' => 'where_null'), compact('column', 'connector', 'not'));
// The type set in this method will be used by the query grammar to call the
// appropriate compiler function for the where clause. For cleanliness, the
// compiler for "not null" and "null" statements is broken into two functions.
$type = ($not) ? 'where_not_null' : 'where_null';
$this->wheres[] = compact('type', 'column', 'connector');
return $this;
}