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