mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-20 14:43:49 +00:00
Fixed: [social issue][admin] do not remove the parent when editing a social issue
https://gitlab.com/Chill-Projet/chill-bundles/-/issues/46
This commit is contained in:
@@ -36,12 +36,19 @@ class SocialIssueType extends AbstractType
|
||||
$builder
|
||||
->add('title', TranslatableStringFormType::class, [
|
||||
'label' => 'Nom',
|
||||
])
|
||||
->add('parent', EntityType::class, [
|
||||
'class' => SocialIssue::class,
|
||||
'required' => false,
|
||||
'choice_label' => fn (SocialIssue $issue): ?string => $this->translatableStringHelper->localize($issue->getTitle()),
|
||||
])
|
||||
]);
|
||||
|
||||
if ('create' === $options['step']) {
|
||||
$builder
|
||||
->add('parent', EntityType::class, [
|
||||
'class' => SocialIssue::class,
|
||||
'required' => false,
|
||||
'choice_label' => fn (SocialIssue $issue): ?string => $this->translatableStringHelper->localize($issue->getTitle()),
|
||||
'mapped' => 'create' === $options['step'],
|
||||
]);
|
||||
}
|
||||
|
||||
$builder
|
||||
->add('ordering', NumberType::class, [
|
||||
'required' => true,
|
||||
'scale' => 6,
|
||||
@@ -55,5 +62,8 @@ class SocialIssueType extends AbstractType
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$resolver->setDefault('class', SocialIssue::class);
|
||||
|
||||
$resolver->setRequired('step')
|
||||
->setAllowedValues('step', ['create', 'edit']);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user