Skip to content

Commit bc27c0a

Browse files
committed
Revert find list shim, too many side effects.
1 parent 816c9a1 commit bc27c0a

File tree

2 files changed

+0
-47
lines changed

2 files changed

+0
-47
lines changed

src/Model/Table/Table.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Cake\ORM\Table as CoreTable;
1111
use Cake\Utility\Inflector;
1212
use Cake\Validation\Validator;
13-
use Closure;
1413
use Exception;
1514
use InvalidArgumentException;
1615

@@ -314,26 +313,6 @@ public function fieldByConditions(string $name, array $conditions = [], array $c
314313
return $result->get($name);
315314
}
316315

317-
/**
318-
* @param \Cake\ORM\Query\SelectQuery $query
319-
* @param \Closure|array|string|null $keyField
320-
* @param \Closure|array|string|null $valueField
321-
* @param \Closure|array|string|null $groupField
322-
* @param string $valueSeparator
323-
* @return \Cake\ORM\Query\SelectQuery
324-
*/
325-
public function findList(SelectQuery $query, array|string|Closure|null $keyField = null, array|string|Closure|null $valueField = null, array|string|Closure|null $groupField = null, string $valueSeparator = ' '): SelectQuery {
326-
$fields = $query->clause('select');
327-
if ($keyField === null && $valueField === null && count($fields) === 2) {
328-
$keyField = array_shift($fields);
329-
$valueField = array_shift($fields);
330-
} elseif ($keyField === null && $valueField === null && count($fields) === 1) {
331-
$valueField = array_shift($fields);
332-
}
333-
334-
return parent::findList($query, $keyField, $valueField, $groupField, $valueSeparator);
335-
}
336-
337316
/**
338317
* Sets the default ordering as 2.x shim.
339318
*

tests/TestCase/Model/Table/TableTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -413,30 +413,4 @@ public function testSaveStrict(): void {
413413
$this->Wheels->save($wheel, ['strict' => true]);
414414
}
415415

416-
/**
417-
* @return void
418-
*/
419-
public function testFindList(): void {
420-
$result = $this->Posts->find('list', fields: ['title', 'body'])->toArray();
421-
$expected = [
422-
'First Post' => 'First Post Body',
423-
'Second Post' => 'Second Post Body',
424-
'Third Post' => 'Third Post Body',
425-
];
426-
$this->assertEquals($expected, $result);
427-
}
428-
429-
/**
430-
* @return void
431-
*/
432-
public function testFindListSingleField(): void {
433-
$result = $this->Posts->find('list', fields: ['id'])->toArray();
434-
$expected = [
435-
1 => 1,
436-
2 => 2,
437-
3 => 3,
438-
];
439-
$this->assertEquals($expected, $result);
440-
}
441-
442416
}

0 commit comments

Comments
 (0)