Skip to content

Commit

Permalink
Set the default type to select.
Browse files Browse the repository at this point in the history
It is the implicit default anyways. If a query object does not have
another query type method called it should behave like a select query.
This change removes annoying failures when using mocked queries.
  • Loading branch information
markstory committed Dec 30, 2013
1 parent c0f7e12 commit 02efb76
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cake/Database/Query.php
Expand Up @@ -47,7 +47,7 @@ class Query implements ExpressionInterface, IteratorAggregate {
*
* @var string
*/
protected $_type;
protected $_type = 'select';

/**
* List of SQL parts that will be used to build this query
Expand Down
2 changes: 1 addition & 1 deletion Cake/ORM/Query.php
Expand Up @@ -417,7 +417,7 @@ public function setResult($results) {
* queries a statement will be returned.
*/
public function execute() {
if ($this->_type === 'select' || $this->_type === null) {
if ($this->_type === 'select') {
$table = $this->repository();
$event = new Event('Model.beforeFind', $table, [$this, $this->_options]);
$table->getEventManager()->dispatch($event);
Expand Down

0 comments on commit 02efb76

Please sign in to comment.