mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-12 21:34:25 +00:00
FIX [translations][types] remove redundant translator and change datetime field to date field
This commit is contained in:
parent
86b5f4dfac
commit
f76c031ff3
@ -13,6 +13,7 @@ namespace Chill\MainBundle\Form;
|
|||||||
|
|
||||||
use Chill\MainBundle\Entity\User;
|
use Chill\MainBundle\Entity\User;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateTimeType;
|
use Chill\MainBundle\Form\Type\ChillDateTimeType;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Symfony\Component\Form\AbstractType;
|
use Symfony\Component\Form\AbstractType;
|
||||||
use Symfony\Component\Form\FormBuilderInterface;
|
use Symfony\Component\Form\FormBuilderInterface;
|
||||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||||
@ -20,20 +21,13 @@ use Symfony\Contracts\Translation\TranslatorInterface;
|
|||||||
|
|
||||||
class AbsenceType extends AbstractType
|
class AbsenceType extends AbstractType
|
||||||
{
|
{
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(TranslatorInterface $translator)
|
|
||||||
{
|
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
{
|
{
|
||||||
$builder
|
$builder
|
||||||
->add('absenceStart', ChillDateTimeType::class, [
|
->add('absenceStart', ChillDateType::class, [
|
||||||
'required' => true,
|
'required' => true,
|
||||||
'input' => 'datetime_immutable',
|
'input' => 'datetime_immutable',
|
||||||
'label' => $this->translator->trans('absence.Absence start'),
|
'label' => 'absence.Absence start',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\Location;
|
|||||||
use Chill\MainBundle\Entity\Scope;
|
use Chill\MainBundle\Entity\Scope;
|
||||||
use Chill\MainBundle\Entity\UserJob;
|
use Chill\MainBundle\Entity\UserJob;
|
||||||
use Chill\MainBundle\Form\Type\ChillDateTimeType;
|
use Chill\MainBundle\Form\Type\ChillDateTimeType;
|
||||||
|
use Chill\MainBundle\Form\Type\ChillDateType;
|
||||||
use Chill\MainBundle\Form\Type\PickCivilityType;
|
use Chill\MainBundle\Form\Type\PickCivilityType;
|
||||||
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
use Chill\MainBundle\Templating\TranslatableStringHelper;
|
||||||
use Doctrine\ORM\EntityRepository;
|
use Doctrine\ORM\EntityRepository;
|
||||||
@ -40,16 +41,12 @@ class UserType extends AbstractType
|
|||||||
|
|
||||||
private TranslatableStringHelper $translatableStringHelper;
|
private TranslatableStringHelper $translatableStringHelper;
|
||||||
|
|
||||||
private TranslatorInterface $translator;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
TranslatableStringHelper $translatableStringHelper,
|
TranslatableStringHelper $translatableStringHelper,
|
||||||
ParameterBagInterface $parameterBag,
|
ParameterBagInterface $parameterBag
|
||||||
TranslatorInterface $translator
|
|
||||||
) {
|
) {
|
||||||
$this->translatableStringHelper = $translatableStringHelper;
|
$this->translatableStringHelper = $translatableStringHelper;
|
||||||
$this->parameterBag = $parameterBag;
|
$this->parameterBag = $parameterBag;
|
||||||
$this->translator = $translator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function buildForm(FormBuilderInterface $builder, array $options)
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||||
@ -117,10 +114,10 @@ class UserType extends AbstractType
|
|||||||
return $qb;
|
return $qb;
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
->add('absenceStart', ChillDateTimeType::class, [
|
->add('absenceStart', ChillDateType::class, [
|
||||||
'required' => false,
|
'required' => false,
|
||||||
'input' => 'datetime_immutable',
|
'input' => 'datetime_immutable',
|
||||||
'label' => $this->translator->trans('absence.Absence start'),
|
'label' => 'absence.Absence start',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
// @phpstan-ignore-next-line
|
||||||
|
Loading…
x
Reference in New Issue
Block a user