File tree Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Expand file tree Collapse file tree 2 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 77use Cake \Datasource \Exception \RecordNotFoundException ;
88use Cake \Datasource \QueryInterface ;
99use Cake \Datasource \QueryTrait ;
10+ use Cake \Datasource \ResultSetInterface ;
1011use Cake \Utility \Hash ;
1112use InvalidArgumentException ;
1213use IteratorAggregate ;
@@ -535,17 +536,19 @@ public function triggerBeforeFind()
535536 */
536537 public function execute ()
537538 {
538- return $ this ->_execute ();
539+ if ($ this ->clause ('action ' ) === self ::ACTION_READ ) {
540+ return $ this ->_execute ();
541+ }
542+
543+ return $ this ->__resultSet = $ this ->_webservice ->execute ($ this );
539544 }
540545
541546 /**
542547 * Executes this query and returns a traversable object containing the results
543548 *
544- * @return bool|int|\Cake\Datasource\ResultSetInterface
545- * @psalm-suppress TraitMethodSignatureMismatch
546- * @psalm-suppress ImplementedReturnTypeMismatch
549+ * @return \Cake\Datasource\ResultSetInterface
547550 */
548- protected function _execute ()
551+ protected function _execute (): ResultSetInterface
549552 {
550553 $ this ->triggerBeforeFind ();
551554 if ($ this ->__resultSet ) {
Original file line number Diff line number Diff line change @@ -167,10 +167,11 @@ public function testExecuteTwice()
167167 {
168168 $ mockWebservice = $ this
169169 ->getMockBuilder ('\TestApp\Webservice\StaticWebservice ' )
170- ->setMethods ([
170+ ->onlyMethods ([
171171 'execute ' ,
172172 ])
173173 ->getMock ();
174+
174175 $ mockWebservice ->expects ($ this ->once ())
175176 ->method ('execute ' )
176177 ->will ($ this ->returnValue (new ResultSet ([
@@ -187,7 +188,10 @@ public function testExecuteTwice()
187188 'title ' => 'Webservices ' ,
188189 ]),
189190 ], 3 )));
190- $ this ->query ->setWebservice ($ mockWebservice );
191+
192+ $ this ->query
193+ ->setWebservice ($ mockWebservice )
194+ ->action (Query::ACTION_READ );
191195
192196 $ this ->query ->execute ();
193197
You can’t perform that action at this time.
0 commit comments