| @@ 122-145 (lines=24) @@ | ||
| 119 | * @param string $toScenario |
|
| 120 | * @return BaseModel[] |
|
| 121 | */ |
|
| 122 | public function findAll(string $toScenario = null) |
|
| 123 | { |
|
| 124 | ||
| 125 | // Check addToCache |
|
| 126 | if (is_null($this->_cacheAll)) { |
|
| 127 | ||
| 128 | $this->_cacheAll = []; |
|
| 129 | ||
| 130 | // Find record in db |
|
| 131 | if ($records = $this->findAllRecords()) { |
|
| 132 | ||
| 133 | foreach ($records as $record) { |
|
| 134 | ||
| 135 | $this->_cacheAll[] = $this->findByRecord($record, $toScenario); |
|
| 136 | ||
| 137 | } |
|
| 138 | ||
| 139 | } |
|
| 140 | ||
| 141 | } |
|
| 142 | ||
| 143 | return $this->_cacheAll; |
|
| 144 | ||
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * @param string $toScenario |
|
| @@ 122-145 (lines=24) @@ | ||
| 119 | * @param string $toScenario |
|
| 120 | * @return BaseObject[] |
|
| 121 | */ |
|
| 122 | public function findAll(string $toScenario = null) |
|
| 123 | { |
|
| 124 | ||
| 125 | // Check addToCache |
|
| 126 | if (is_null($this->_cacheAll)) { |
|
| 127 | ||
| 128 | $this->_cacheAll = []; |
|
| 129 | ||
| 130 | // Find record in db |
|
| 131 | if ($records = $this->findAllRecords()) { |
|
| 132 | ||
| 133 | foreach ($records as $record) { |
|
| 134 | ||
| 135 | $this->_cacheAll[] = $this->findByRecord($record, $toScenario); |
|
| 136 | ||
| 137 | } |
|
| 138 | ||
| 139 | } |
|
| 140 | ||
| 141 | } |
|
| 142 | ||
| 143 | return $this->_cacheAll; |
|
| 144 | ||
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * @param string $toScenario |
|