mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 22:53:49 +00:00
apply rector rules: symfony **UP TO** 44
This commit is contained in:
@@ -19,6 +19,6 @@ class ChillCustomFieldsBundle extends Bundle
|
||||
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container)
|
||||
{
|
||||
parent::build($container);
|
||||
$container->addCompilerPass(new CustomFieldCompilerPass());
|
||||
$container->addCompilerPass(new CustomFieldCompilerPass(), \Symfony\Component\DependencyInjection\Compiler\PassConfig::TYPE_BEFORE_OPTIMIZATION, 0);
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@ class CustomFieldController extends AbstractController
|
||||
$form = $this->createCreateForm($entity, $request->query->get('type', null));
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
@@ -40,10 +40,7 @@ class CustomFieldController extends AbstractController
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
->trans('The custom field has been created'));
|
||||
|
||||
return $this->redirect($this->generateUrl(
|
||||
'customfieldsgroup_show',
|
||||
['id' => $entity->getCustomFieldsGroup()->getId()]
|
||||
));
|
||||
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getCustomFieldsGroup()->getId()]);
|
||||
}
|
||||
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
@@ -141,13 +138,13 @@ class CustomFieldController extends AbstractController
|
||||
$editForm = $this->createEditForm($entity, $entity->getType());
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->get('translator')
|
||||
->trans('The custom field has been updated'));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfield_edit', ['id' => $id]));
|
||||
return $this->redirectToRoute('customfield_edit', ['id' => $id]);
|
||||
}
|
||||
|
||||
$this->addFlash('error', $this->get('translator')
|
||||
|
@@ -49,7 +49,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
$form = $this->createCreateForm($entity);
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
if ($form->isSubmitted() && $form->isValid()) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist($entity);
|
||||
$em->flush();
|
||||
@@ -57,7 +57,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The custom fields group has been created'));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfieldsgroup_show', ['id' => $entity->getId()]));
|
||||
return $this->redirectToRoute('customfieldsgroup_show', ['id' => $entity->getId()]);
|
||||
}
|
||||
|
||||
$this->addFlash('error', $this->translator
|
||||
@@ -157,7 +157,7 @@ class CustomFieldsGroupController extends AbstractController
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The default custom fields group has been changed'));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfieldsgroup'));
|
||||
return $this->redirectToRoute('customfieldsgroup');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -261,13 +261,13 @@ class CustomFieldsGroupController extends AbstractController
|
||||
$editForm = $this->createEditForm($entity);
|
||||
$editForm->handleRequest($request);
|
||||
|
||||
if ($editForm->isValid()) {
|
||||
if ($editForm->isSubmitted() && $editForm->isValid()) {
|
||||
$em->flush();
|
||||
|
||||
$this->addFlash('success', $this->translator
|
||||
->trans('The custom fields group has been updated'));
|
||||
|
||||
return $this->redirect($this->generateUrl('customfieldsgroup_edit', ['id' => $id]));
|
||||
return $this->redirectToRoute('customfieldsgroup_edit', ['id' => $id]);
|
||||
}
|
||||
|
||||
$this->addFlash('error', $this->translator
|
||||
|
@@ -95,12 +95,4 @@ class CustomFieldsGroupType extends AbstractType
|
||||
'data_class' => CustomFieldsGroup::class,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'custom_fields_group';
|
||||
}
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
|
||||
*/
|
||||
class PostTextIntegerExtension extends PostTextExtension
|
||||
{
|
||||
public function getExtendedType()
|
||||
public function getExtendedTypes(): iterable
|
||||
{
|
||||
return IntegerType::class;
|
||||
return [IntegerType::class];
|
||||
}
|
||||
}
|
||||
|
@@ -18,8 +18,8 @@ use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
*/
|
||||
class PostTextNumberExtension extends PostTextExtension
|
||||
{
|
||||
public function getExtendedType()
|
||||
public function getExtendedTypes(): iterable
|
||||
{
|
||||
return NumberType::class;
|
||||
return [NumberType::class];
|
||||
}
|
||||
}
|
||||
|
@@ -53,9 +53,4 @@ class ChoiceWithOtherType extends AbstractType
|
||||
'multiple' => false,
|
||||
]);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'choice_with_other';
|
||||
}
|
||||
}
|
||||
|
@@ -45,9 +45,4 @@ class CustomFieldType extends AbstractType
|
||||
->setRequired(['group'])
|
||||
->addAllowedTypes('group', [\Chill\CustomFieldsBundle\Entity\CustomFieldsGroup::class]);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
{
|
||||
return 'custom_field';
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user