Fix crudconfig

This commit is contained in:
Julie Lenaerts 2024-04-24 11:44:14 +02:00
parent 56d5d08ed3
commit 650e85c481
2 changed files with 10 additions and 17 deletions

View File

@ -22,7 +22,7 @@ use Symfony\Component\Routing\Annotation\Route;
class CSPersonController extends OneToOneEntityPersonCRUDController
{
public function personalSituationEdit(Request $request, $id)
public function personalSituationEdit(Request $request, $id): Response
{
return $this->formEditAction(
'ps_situation_edit',
@ -72,7 +72,7 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
return $this->generateUrl($route, ['id' => $entity->getPerson()->getId()]);
}
protected function checkACL($action, $entity)
protected function checkACL($action, $entity): void
{
match ($action) {
'ps_situation_edit', 'dispositifs_edit' => $this->denyAccessUnlessGranted(
@ -116,16 +116,8 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
protected function createFormFor(string $action, $entity, ?string $formClass = null, array $formOptions = []): FormInterface
{
switch ($action) {
case 'dispositifs_edit':
$form = $this->createForm($formClass, $entity, \array_merge(
$formOptions,
['center' => $entity->getPerson()->getCenter()]
));
$this->customizeForm($action, $form);
return $form;
case 'ps_situation_edit':
case 'dispositifs_edit':
$form = $this->createForm($formClass, $entity, \array_merge(
$formOptions,
['center' => $entity->getPerson()->getCenter()]
@ -139,7 +131,7 @@ class CSPersonController extends OneToOneEntityPersonCRUDController
}
}
protected function generateLabelForButton($action, $formName, $form)
protected function generateLabelForButton($action, $formName, $form): string
{
switch ($action) {
case 'ps_situation_edit':

View File

@ -48,9 +48,10 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
public function prepend(ContainerBuilder $container): void
{
$this->prependRoute($container);
$this->prependCruds($container);
}
/* protected function prependCruds(ContainerBuilder $container)
protected function prependCruds(ContainerBuilder $container)
{
$container->prependExtensionConfig('chill_main', [
'cruds' => [
@ -58,9 +59,9 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
'class' => CSPerson::class,
'controller' => CSPersonController::class,
'name' => 'admin_personal_situation',
// 'base_path' => '/admin/main/personal_situation',
'base_role' => 'ROLE_USER',
'form_class' => CSPersonPersonalSituationType::class,
'base_path' => '/person/job/',
/* 'form_class' => CSPersonPersonalSituationType::class,
'actions' => [
'index' => [
'role' => 'ROLE_USER',
@ -74,11 +75,11 @@ class ChillJobExtension extends Extension implements PrependExtensionInterface
'role' => 'ROLE_USER',
'template' => '@ChillPerson/CRUD/edit.html.twig',
],
],
],*/
]
],
]);
}*/
}
protected function prependRoute(ContainerBuilder $container): void
{