| 1 | <?php |
||
| 7 | abstract class Controller |
||
| 8 | { |
||
| 9 | protected const ORDER_BY_ASC = 'ASC'; |
||
| 10 | protected const ORDER_BY_DESC = 'DESC'; |
||
| 11 | |||
| 12 | protected $requestHandler; |
||
| 13 | |||
| 14 | 18 | public function __construct(RequestHandler $requestHandler) |
|
| 18 | |||
| 19 | 2 | protected function validateIsNotNewEntity(string $id) |
|
| 25 | |||
| 26 | 1 | protected function doCreate(string $path, $entity, callable $mappingFunction) |
|
| 33 | |||
| 34 | 1 | protected function doUpdate(string $path, $entity, callable $mappingFunction) |
|
| 41 | |||
| 42 | 1 | protected function doDelete(string $path) |
|
| 47 | |||
| 48 | 1 | protected function doFetch(string $path, callable $mappingFunction) |
|
| 52 | |||
| 53 | 2 | protected function doFetchOne(string $path, string $orderBy = null, string $order = self::ORDER_BY_ASC, callable $mappingFunction) |
|
| 67 | } |
||
| 68 |