mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
fix requirements on POST route
This commit is contained in:
parent
ebe3bc5f7b
commit
c9e6935f15
@ -192,7 +192,7 @@ class CRUDRoutesLoader extends Loader
|
||||
if ('_entity' === $name && \in_array(Request::METHOD_POST, $methods)) {
|
||||
unset($methods[\array_search(Request::METHOD_POST, $methods)]);
|
||||
$entityPostRoute = $this->createEntityPostRoute($name, $crudConfig, $action,
|
||||
$controller, $requirements);
|
||||
$controller);
|
||||
$collection->add("chill_api_single_{$crudConfig['name']}_{$name}_create",
|
||||
$entityPostRoute);
|
||||
}
|
||||
@ -212,13 +212,14 @@ class CRUDRoutesLoader extends Loader
|
||||
return $collection;
|
||||
}
|
||||
|
||||
private function createEntityPostRoute(string $name, $crudConfig, array $action, $controller, $requirements): Route
|
||||
private function createEntityPostRoute(string $name, $crudConfig, array $action, $controller): Route
|
||||
{
|
||||
$localPath = $action['path'].'.{_format}';
|
||||
$defaults = [
|
||||
'_controller' => $controller.':'.($action['controller_action'] ?? 'entityPost')
|
||||
];
|
||||
$path = $crudConfig['base_path'].$localPath;
|
||||
$requirements = $action['requirements'] ?? [];
|
||||
$route = new Route($path, $defaults, $requirements);
|
||||
$route->setMethods([ Request::METHOD_POST ]);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user