Skip to content

Commit

Permalink
QB where() clauses now support Model objects
Browse files Browse the repository at this point in the history
  • Loading branch information
allejo committed Feb 10, 2018
1 parent db0605b commit 27fd41d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/QueryBuilder/QueryBuilderFlex.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ public function __construct(\Pixie\Connection $connection = null)
$this->setFetchMode(PDO::FETCH_ASSOC);
}


/**
* {@inheritdoc}
*/
Expand All @@ -91,6 +90,18 @@ public function limit($limit)
return parent::limit($limit);
}

/**
* {@inheritdoc}
*/
protected function whereHandler($key, $operator = null, $value = null, $joiner = 'AND')
{
if ($value instanceof BaseModel) {
$value = $value->getId();
}

return parent::whereHandler($key, $operator, $value, $joiner);
}

//
// QueryBuilderFlex unique functions
//
Expand Down

0 comments on commit 27fd41d

Please sign in to comment.