Skip to content
Permalink
Browse files

Removing Table::find() overloading

  • Loading branch information...
lorenzo committed Dec 21, 2013
1 parent db62855 commit c1c63d6726152a4c835ce4566c3bc99714f5fb33
Showing with 14 additions and 29 deletions.
  1. +14 −8 Cake/ORM/Table.php
  2. +0 −21 Cake/Test/TestCase/ORM/TableTest.php
@@ -670,17 +670,23 @@ public function belongsToMany($associated, array $options = []) {
* Each find() will trigger a `Model.beforeFind` event for all attached
* listeners. Any listener can set a valid result set using $query
*
* @param string|array $type the type of query to perform, if an array is passed,
* it will be interpreted as the `$options` parameter
* @param array $options
* @param string $type the type of query to perform
* @param array $options An array that will be passed to Query::applyOptions
* By default it allows the following keys:
* - fields
* - conditions
* - order
* - limit
* - offset
* - page
* - order
* - group
* - having
* - contain
* - join
* @return \Cake\ORM\Query
*/
public function find($type = 'all', $options = []) {
if (!is_string($type)) {
$options = $type;
$type = 'all';
}
$query = $this->_buildQuery();
$query->select()->applyOptions($options);
return $this->callFinder($type, $query, $options);
@@ -2962,27 +2962,6 @@ public function testSimplifiedFind() {
$table->find();
}
/**
* Tests that it is possible to pass the conditions as first argument in find
*
* @return void
*/
public function testFindFirstParamAsArray() {
$table = $this->getMock(
'\Cake\ORM\Table',
['callFinder'],
[[
'connection' => $this->connection,
'schema' => ['id' => ['type' => 'integer']]
]]
);
$query = (new \Cake\ORM\Query($this->connection, $table))->select(['id']);
$table->expects($this->once())->method('callFinder')
->with('all', $query, ['fields' => ['id']]);
$table->find(['fields' => ['id']]);
}
/**
* Test that get() will use the primary key for searching and return the first
* entity found

0 comments on commit c1c63d6

Please sign in to comment.
You can’t perform that action at this time.