logic moved to controller instead of form

This commit is contained in:
2021-10-07 10:56:10 +02:00
parent b510d6a7f5
commit 9d6958a835
2 changed files with 5 additions and 8 deletions

View File

@@ -93,10 +93,6 @@ class ActivityType extends AbstractType
/** @var \Chill\ActivityBundle\Entity\ActivityType $activityType */
$activityType = $options['activityType'];
if (!$activityType->isActive() && $options['edit'] !== true) {
throw new \InvalidArgumentException('Activity type must be active');
}
// TODO revoir la gestion des center au niveau du form des activité.
if ($options['center']) {
$builder->add('scope', ScopePickerType::class, [
@@ -378,12 +374,11 @@ class ActivityType extends AbstractType
]);
$resolver
->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod', 'edit'])
->setRequired(['center', 'role', 'activityType', 'accompanyingPeriod'])
->setAllowedTypes('center', ['null', 'Chill\MainBundle\Entity\Center'])
->setAllowedTypes('role', 'Symfony\Component\Security\Core\Role\Role')
->setAllowedTypes('activityType', \Chill\ActivityBundle\Entity\ActivityType::class)
->setAllowedTypes('accompanyingPeriod', [\Chill\PersonBundle\Entity\AccompanyingPeriod::class, 'null'])
->setAllowedTypes('edit', 'bool')
;
}