|
@@ 111-113 (lines=3) @@
|
| 108 |
|
// if the class implements any of CRUD methods a corresponding route will be added |
| 109 |
|
// as HTML forms do not support methods other than GET/POST we use POST and special URI for update and delete. |
| 110 |
|
$classInterfaces = class_implements($controllerClass); |
| 111 |
|
if (in_array(ControllerIndexInterface::class, $classInterfaces) === true) { |
| 112 |
|
$group->get($subUri, $handler(FCI::METHOD_INDEX), $params(FCI::METHOD_INDEX)); |
| 113 |
|
} |
| 114 |
|
if (in_array(ControllerInstanceInterface::class, $classInterfaces) === true) { |
| 115 |
|
$group->get($subUri . $createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE)); |
| 116 |
|
} |
|
@@ 114-116 (lines=3) @@
|
| 111 |
|
if (in_array(ControllerIndexInterface::class, $classInterfaces) === true) { |
| 112 |
|
$group->get($subUri, $handler(FCI::METHOD_INDEX), $params(FCI::METHOD_INDEX)); |
| 113 |
|
} |
| 114 |
|
if (in_array(ControllerInstanceInterface::class, $classInterfaces) === true) { |
| 115 |
|
$group->get($subUri . $createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE)); |
| 116 |
|
} |
| 117 |
|
if (in_array(ControllerCreateInterface::class, $classInterfaces) === true) { |
| 118 |
|
$group->post($subUri . $createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE)); |
| 119 |
|
} |
|
@@ 117-119 (lines=3) @@
|
| 114 |
|
if (in_array(ControllerInstanceInterface::class, $classInterfaces) === true) { |
| 115 |
|
$group->get($subUri . $createSubUrl, $handler(FCI::METHOD_INSTANCE), $params(FCI::METHOD_INSTANCE)); |
| 116 |
|
} |
| 117 |
|
if (in_array(ControllerCreateInterface::class, $classInterfaces) === true) { |
| 118 |
|
$group->post($subUri . $createSubUrl, $handler(FCI::METHOD_CREATE), $params(FCI::METHOD_CREATE)); |
| 119 |
|
} |
| 120 |
|
if (in_array(ControllerReadInterface::class, $classInterfaces) === true) { |
| 121 |
|
$group->get($slugged, $handler(FCI::METHOD_READ), $params(FCI::METHOD_READ)); |
| 122 |
|
} |
|
@@ 126-129 (lines=4) @@
|
| 123 |
|
if (in_array(ControllerUpdateInterface::class, $classInterfaces) === true) { |
| 124 |
|
$group->post($slugged, $handler(FCI::METHOD_UPDATE), $params(FCI::METHOD_UPDATE)); |
| 125 |
|
} |
| 126 |
|
if (in_array(ControllerDeleteInterface::class, $classInterfaces) === true) { |
| 127 |
|
$deleteUri = $slugged . '/' . FCI::METHOD_DELETE; |
| 128 |
|
$group->post($deleteUri, $handler(FCI::METHOD_DELETE), $params(FCI::METHOD_DELETE)); |
| 129 |
|
} |
| 130 |
|
|
| 131 |
|
return $group; |
| 132 |
|
} |