mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
fix cs
This commit is contained in:
@@ -32,6 +32,7 @@ class AdminDocGeneratorTemplateController extends CRUDController
|
||||
switch ($action) {
|
||||
case 'new':
|
||||
$context = $this->contextManager->getContextByKey($request->get('context'));
|
||||
// no break
|
||||
case 'edit':
|
||||
$context = $this->contextManager->getContextByDocGeneratorTemplate($entity);
|
||||
|
||||
@@ -39,6 +40,7 @@ class AdminDocGeneratorTemplateController extends CRUDController
|
||||
$defaultTemplateParameters,
|
||||
['context' => $context]
|
||||
);
|
||||
|
||||
case 'index':
|
||||
return array_merge(
|
||||
$defaultTemplateParameters,
|
||||
@@ -48,7 +50,6 @@ class AdminDocGeneratorTemplateController extends CRUDController
|
||||
default:
|
||||
return parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters); // TODO: Change the autogenerated stub
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function new(Request $request): Response
|
||||
|
@@ -90,7 +90,6 @@ final class DocGeneratorTemplateController extends AbstractController
|
||||
int $entityId,
|
||||
Request $request
|
||||
): Response {
|
||||
|
||||
try {
|
||||
$context = $this->contextManager->getContextByDocGeneratorTemplate($template);
|
||||
} catch (ContextNotFoundException $e) {
|
||||
|
@@ -1,18 +1,28 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Chill is a software for social workers
|
||||
*
|
||||
* For the full copyright and license information, please view
|
||||
* the LICENSE file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Chill\DocGeneratorBundle\Menu;
|
||||
|
||||
use Chill\MainBundle\Routing\LocalMenuBuilderInterface;
|
||||
use Knp\Menu\MenuItem;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface;
|
||||
use function in_array;
|
||||
|
||||
class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
private Security $security;
|
||||
|
||||
private TranslatorInterface $translator;
|
||||
|
||||
public function __construct(TranslatorInterface $translator, Security $security)
|
||||
{
|
||||
$this->translator = $translator;
|
||||
@@ -22,12 +32,12 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
public function buildMenu($menuId, MenuItem $menu, array $parameters)
|
||||
{
|
||||
if ($this->security->isGranted('ROLE_ADMIN')) {
|
||||
if (in_array($menuId, ['admin_index', 'admin_section'])) {
|
||||
if (in_array($menuId, ['admin_index', 'admin_section'], true)) {
|
||||
$menu->addChild($this->translator->trans('docgen.Document generation'), [
|
||||
'route' => 'chill_crud_docgen_template_index'
|
||||
'route' => 'chill_crud_docgen_template_index',
|
||||
])->setExtras([
|
||||
'order' => 350,
|
||||
'explain' => 'docgen.Manage templates and document generation'
|
||||
'explain' => 'docgen.Manage templates and document generation',
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -37,6 +47,4 @@ class AdminMenuBuilder implements LocalMenuBuilderInterface
|
||||
{
|
||||
return ['admin_index', 'admin_section', 'docgen_admin'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -212,6 +212,7 @@ class DocGenObjectNormalizer implements NormalizerAwareInterface, NormalizerInte
|
||||
|
||||
if (is_iterable($value)) {
|
||||
$arr = [];
|
||||
|
||||
foreach ($value as $k => $v) {
|
||||
$arr[$k] =
|
||||
$this->normalizer->normalize($v, $format, array_merge(
|
||||
|
Reference in New Issue
Block a user