mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
DX: fix phpstan errors
This commit is contained in:
@@ -34,6 +34,29 @@ abstract class AbstractCRUDController extends AbstractController
|
||||
*/
|
||||
protected array $crudConfig = [];
|
||||
|
||||
/**
|
||||
* get the role given from the config.
|
||||
*
|
||||
* @param mixed $entity
|
||||
* @param mixed $_format
|
||||
*/
|
||||
protected function getRoleFor(string $action, Request $request, $entity, $_format): string
|
||||
{
|
||||
$actionConfig = $this->getActionConfig($action);
|
||||
|
||||
if (null !== $actionConfig['roles'][$request->getMethod()]) {
|
||||
return $actionConfig['roles'][$request->getMethod()];
|
||||
}
|
||||
|
||||
if ($this->crudConfig['base_role']) {
|
||||
return $this->crudConfig['base_role'];
|
||||
}
|
||||
|
||||
throw new \RuntimeException(sprintf('the config does not have any role for the ' .
|
||||
'method %s nor a global role for the whole action. Add those to your ' .
|
||||
'configuration or override the required method', $request->getMethod()));
|
||||
}
|
||||
|
||||
public static function getSubscribedServices(): array
|
||||
{
|
||||
return array_merge(
|
||||
|
Reference in New Issue
Block a user