| @@ 266-278 (lines=13) @@ | ||
| 263 | * @return Model |
|
| 264 | * @throws ModelNotFoundException |
|
| 265 | */ |
|
| 266 | public function getById(int $id, string $toScenario = null): Model |
|
| 267 | { |
|
| 268 | ||
| 269 | // Find by ID |
|
| 270 | if (!$model = $this->findById($id, $toScenario)) { |
|
| 271 | ||
| 272 | $this->notFoundByIdException($id); |
|
| 273 | ||
| 274 | } |
|
| 275 | ||
| 276 | return $model; |
|
| 277 | ||
| 278 | } |
|
| 279 | ||
| 280 | /** |
|
| 281 | * @param int $id |
|
| @@ 306-317 (lines=12) @@ | ||
| 303 | * @return Model |
|
| 304 | * @throws ModelNotFoundException |
|
| 305 | */ |
|
| 306 | public function freshGetById(int $id, string $toScenario = null): Model |
|
| 307 | { |
|
| 308 | ||
| 309 | if (!$model = $this->freshFindById($id, $toScenario)) { |
|
| 310 | ||
| 311 | $this->notFoundByIdException($id); |
|
| 312 | ||
| 313 | } |
|
| 314 | ||
| 315 | return $model; |
|
| 316 | ||
| 317 | } |
|
| 318 | ||
| 319 | /******************************************* |
|
| 320 | * FIND/GET BY QUERY |
|