From 02efb76d4b605362febb11c0a8a2279c8fe9fdc2 Mon Sep 17 00:00:00 2001 From: mark_story Date: Fri, 27 Dec 2013 23:56:55 -0500 Subject: [PATCH] Set the default type to select. 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. --- Cake/Database/Query.php | 2 +- Cake/ORM/Query.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cake/Database/Query.php b/Cake/Database/Query.php index 034d2ed8fad..ca2e2f23840 100644 --- a/Cake/Database/Query.php +++ b/Cake/Database/Query.php @@ -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 diff --git a/Cake/ORM/Query.php b/Cake/ORM/Query.php index 5705236bb66..a43a959fef5 100644 --- a/Cake/ORM/Query.php +++ b/Cake/ORM/Query.php @@ -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);