mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge pull request #1125 from dogmatic69/find-all-overload
Adding the _findAll method
This commit is contained in:
commit
4879d45115
1 changed files with 18 additions and 5 deletions
|
@ -2695,10 +2695,6 @@ class Model extends Object implements CakeEventListener {
|
|||
|
||||
$this->findQueryType = null;
|
||||
|
||||
if ($type === 'all') {
|
||||
return $results;
|
||||
}
|
||||
|
||||
if ($this->findMethods[$type] === true) {
|
||||
return $this->{'_find' . ucfirst($type)}('after', $query, $results);
|
||||
}
|
||||
|
@ -2721,7 +2717,7 @@ class Model extends Object implements CakeEventListener {
|
|||
(array)$query
|
||||
);
|
||||
|
||||
if ($type !== 'all' && $this->findMethods[$type] === true) {
|
||||
if ($this->findMethods[$type] === true) {
|
||||
$query = $this->{'_find' . ucfirst($type)}('before', $query);
|
||||
}
|
||||
|
||||
|
@ -2749,6 +2745,23 @@ class Model extends Object implements CakeEventListener {
|
|||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the before/after filter logic for find('all') operations. Only called by Model::find().
|
||||
*
|
||||
* @param string $state Either "before" or "after"
|
||||
* @param array $query
|
||||
* @param array $results
|
||||
* @return array
|
||||
* @see Model::find()
|
||||
*/
|
||||
protected function _findAll($state, $query, $results = array()) {
|
||||
if ($state === 'before') {
|
||||
return $query;
|
||||
} elseif ($state === 'after') {
|
||||
return $results;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the before/after filter logic for find('first') operations. Only called by Model::find().
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue