diff --git a/src/Bundle/ChillEventBundle/Controller/EventController.php b/src/Bundle/ChillEventBundle/Controller/EventController.php index 09cb86861..0cc207d7b 100644 --- a/src/Bundle/ChillEventBundle/Controller/EventController.php +++ b/src/Bundle/ChillEventBundle/Controller/EventController.php @@ -23,11 +23,11 @@ use Chill\MainBundle\Security\Authorization\AuthorizationHelperInterface; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Form\Type\PickPersonDynamicType; use Chill\PersonBundle\Privacy\PrivacyEvent; +use Doctrine\Persistence\ManagerRegistry; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Csv; use PhpOffice\PhpSpreadsheet\Writer\Ods; use PhpOffice\PhpSpreadsheet\Writer\Xlsx; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -41,8 +41,10 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\Security\Core\Security; +use Symfony\Component\Serializer\Exception\ExceptionInterface; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Contracts\Translation\TranslatorInterface; +use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; /** * Class EventController. @@ -59,9 +61,8 @@ final class EventController extends AbstractController private readonly TranslatorInterface $translator, private readonly PaginatorFactory $paginator, private readonly Security $security, - private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry, + private readonly ManagerRegistry $managerRegistry, private readonly SerializerInterface $serializer, - ) {} #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'POST', 'DELETE'])] @@ -172,6 +173,8 @@ final class EventController extends AbstractController /** * Displays a form to create a new Event entity. + * + * @throws ExceptionInterface */ #[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new', name: 'chill_event__event_new', methods: ['GET', 'POST'])] public function newAction(?Center $center, Request $request): Response diff --git a/src/Bundle/ChillEventBundle/Entity/Event.php b/src/Bundle/ChillEventBundle/Entity/Event.php index 604b570c2..e7b0346cd 100644 --- a/src/Bundle/ChillEventBundle/Entity/Event.php +++ b/src/Bundle/ChillEventBundle/Entity/Event.php @@ -200,7 +200,7 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter $this->animators->removeElement($tp); } - public function getCenter(): ?Center + public function getCenter(): Center { return $this->center; } diff --git a/src/Bundle/ChillEventBundle/Entity/EventBudgetElement.php b/src/Bundle/ChillEventBundle/Entity/EventBudgetElement.php index 97c25cf1e..ae2fcb1be 100644 --- a/src/Bundle/ChillEventBundle/Entity/EventBudgetElement.php +++ b/src/Bundle/ChillEventBundle/Entity/EventBudgetElement.php @@ -52,6 +52,7 @@ class EventBudgetElement { $this->id = $id; } + public function getAmount(): float { return (float) $this->amount; diff --git a/src/Bundle/ChillEventBundle/Entity/EventTheme.php b/src/Bundle/ChillEventBundle/Entity/EventTheme.php index 28bc87e04..1a0461cbd 100644 --- a/src/Bundle/ChillEventBundle/Entity/EventTheme.php +++ b/src/Bundle/ChillEventBundle/Entity/EventTheme.php @@ -80,24 +80,14 @@ class EventTheme return $this->name; } - /** - * Set active. - * - * @return EventTheme - */ - public function setIsActive(bool $active): static + public function setIsActive(bool $active): self { $this->isActive = $active; return $this; } - /** - * Set label. - * - * @return EventTheme - */ - public function setName(array $label): static + public function setName(array $label): self { $this->name = $label; @@ -130,23 +120,9 @@ class EventTheme return $this->children; } - public function getDescendants(): Collection + public function hasChildren(): bool { - $descendants = new ArrayCollection(); - - foreach ($this->getChildren() as $child) { - if (!$descendants->contains($child)) { - $descendants->add($child); - - foreach ($child->getDescendants() as $descendantsOfChild) { - if (!$descendants->contains($descendantsOfChild)) { - $descendants->add($descendantsOfChild); - } - } - } - } - - return $descendants; + return 0 < $this->getChildren()->count(); } public function hasParent(): bool diff --git a/src/Bundle/ChillEventBundle/Export/Export/ListEvents.php b/src/Bundle/ChillEventBundle/Export/Export/ListEvents.php index 4fee6b23b..a0784a225 100644 --- a/src/Bundle/ChillEventBundle/Export/Export/ListEvents.php +++ b/src/Bundle/ChillEventBundle/Export/Export/ListEvents.php @@ -108,7 +108,7 @@ class ListEvents implements ListInterface, GroupedExportInterface return 'Exports of events'; } - public function getLabels($key, array $values, $data): \Closure + public function getLabels($key, array $values, $data) { return match ($key) { 'event_id' => fn ($value) => '_header' === $value ? 'export.event.list.'.$key : $value, @@ -258,21 +258,21 @@ class ListEvents implements ListInterface, GroupedExportInterface break; case 'event_type': - if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.type')) { + if (!$this->hasJoin($qb, 'event.type')) { $qb->leftJoin('event.type', 'type'); } $qb->addSelect('type.name AS event_type'); break; case 'event_center': - if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.center')) { + if (!$this->hasJoin($qb, 'event.center')) { $qb->leftJoin('event.center', 'center'); } $qb->addSelect('center.name AS event_center'); break; case 'event_moderator': - if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.moderator')) { + if (!$this->hasJoin($qb, 'event.moderator')) { $qb->leftJoin('event.moderator', 'user'); } $qb->addSelect('user.username AS event_moderator'); @@ -283,7 +283,7 @@ class ListEvents implements ListInterface, GroupedExportInterface break; case 'event_location': - if (!$qb->getDQLPart('join') || !$this->hasJoin($qb, 'event.location')) { + if (!$this->hasJoin($qb, 'event.location')) { $qb->leftJoin('event.location', 'location'); } $qb->addSelect('location.name AS event_location'); diff --git a/src/Bundle/ChillEventBundle/Form/AddEventBudgetElementType.php b/src/Bundle/ChillEventBundle/Form/AddEventBudgetElementType.php index 4c3dcc467..c577262bb 100644 --- a/src/Bundle/ChillEventBundle/Form/AddEventBudgetElementType.php +++ b/src/Bundle/ChillEventBundle/Form/AddEventBudgetElementType.php @@ -25,7 +25,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class AddEventBudgetElementType extends AbstractType { - public function __construct(private EventBudgetKindRepository $kindRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} + public function __construct(private readonly EventBudgetKindRepository $kindRepository, private readonly TranslatableStringHelperInterface $translatableStringHelper) {} public function buildForm(FormBuilderInterface $builder, array $options): void { diff --git a/src/Bundle/ChillEventBundle/Form/EventBudgetKindType.php b/src/Bundle/ChillEventBundle/Form/EventBudgetKindType.php index 807a0fdc3..571c4f942 100644 --- a/src/Bundle/ChillEventBundle/Form/EventBudgetKindType.php +++ b/src/Bundle/ChillEventBundle/Form/EventBudgetKindType.php @@ -12,11 +12,11 @@ declare(strict_types=1); namespace Chill\EventBundle\Form; use Chill\EventBundle\Entity\BudgetTypeEnum; +use Chill\EventBundle\Entity\EventBudgetKind; use Chill\MainBundle\Form\Type\TranslatableStringFormType; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\EnumType; -use Symfony\Component\Form\Extension\Core\Type\NumberType; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Contracts\Translation\TranslatorInterface; @@ -48,6 +48,6 @@ class EventBudgetKindType extends AbstractType public function configureOptions(OptionsResolver $resolver) { $resolver - ->setDefault('class', ChargeKind::class); + ->setDefault('class', EventBudgetKind::class); } } diff --git a/src/Bundle/ChillEventBundle/Form/EventThemeType.php b/src/Bundle/ChillEventBundle/Form/EventThemeType.php index f48780641..351bf5a59 100644 --- a/src/Bundle/ChillEventBundle/Form/EventThemeType.php +++ b/src/Bundle/ChillEventBundle/Form/EventThemeType.php @@ -38,7 +38,7 @@ class EventThemeType extends AbstractType 'class' => EventTheme::class, 'required' => false, 'choice_label' => fn (EventTheme $theme): ?string => $this->translatableStringHelper->localize($theme->getName()), - 'mapped' => 'create' === $options['step'], + 'mapped' => 'create' == $options['step'], ]); } diff --git a/src/Bundle/ChillEventBundle/Form/EventType.php b/src/Bundle/ChillEventBundle/Form/EventType.php index ef35ce04b..a6c421d04 100644 --- a/src/Bundle/ChillEventBundle/Form/EventType.php +++ b/src/Bundle/ChillEventBundle/Form/EventType.php @@ -109,9 +109,6 @@ class EventType extends AbstractType ->setAllowedTypes('role', 'string'); } - /** - * @return string - */ public function getBlockPrefix(): string { // as the js shares some hardcoded items from the activity bundle, we have to rewrite block prefix diff --git a/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php b/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php index 472fdd463..1365e9e1b 100644 --- a/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php +++ b/src/Bundle/ChillEventBundle/Form/Type/PickEventTypeType.php @@ -23,11 +23,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver; */ class PickEventTypeType extends AbstractType { - protected TranslatableStringHelper $translatableStringHelper; - - public function __construct(TranslatableStringHelper $helper) + public function __construct(protected TranslatableStringHelper $translatableStringHelper) { - $this->translatableStringHelper = $helper; } public function configureOptions(OptionsResolver $resolver) diff --git a/src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php b/src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php index c67b095b6..8b7535ffe 100644 --- a/src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php +++ b/src/Bundle/ChillEventBundle/Menu/AdminMenuBuilder.php @@ -17,11 +17,8 @@ use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; class AdminMenuBuilder implements LocalMenuBuilderInterface { - protected AuthorizationCheckerInterface $authorizationChecker; - - public function __construct(AuthorizationCheckerInterface $authorizationChecker) + public function __construct(protected AuthorizationCheckerInterface $authorizationChecker) { - $this->authorizationChecker = $authorizationChecker; } public function buildMenu($menuId, MenuItem $menu, array $parameters): void diff --git a/src/Bundle/ChillEventBundle/Repository/EventBudgetElementRepository.php b/src/Bundle/ChillEventBundle/Repository/EventBudgetElementRepository.php index 3d700abba..48b871dc2 100644 --- a/src/Bundle/ChillEventBundle/Repository/EventBudgetElementRepository.php +++ b/src/Bundle/ChillEventBundle/Repository/EventBudgetElementRepository.php @@ -24,5 +24,4 @@ class EventBudgetElementRepository extends ServiceEntityRepository { parent::__construct($registry, EventBudgetElement::class); } - } diff --git a/src/Bundle/ChillEventBundle/Repository/EventThemeRepository.php b/src/Bundle/ChillEventBundle/Repository/EventThemeRepository.php index c8956356b..add79faeb 100644 --- a/src/Bundle/ChillEventBundle/Repository/EventThemeRepository.php +++ b/src/Bundle/ChillEventBundle/Repository/EventThemeRepository.php @@ -34,5 +34,4 @@ class EventThemeRepository extends ServiceEntityRepository ->getQuery() ->getResult(); } - } diff --git a/src/Bundle/ChillEventBundle/migrations/Version20250429062911.php b/src/Bundle/ChillEventBundle/migrations/Version20250429062911.php index 9f931eaa1..967442601 100644 --- a/src/Bundle/ChillEventBundle/migrations/Version20250429062911.php +++ b/src/Bundle/ChillEventBundle/migrations/Version20250429062911.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * 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. + */ + namespace Chill\Migrations\Event; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillEventBundle/migrations/Version20250505120818.php b/src/Bundle/ChillEventBundle/migrations/Version20250505120818.php index 464fbbf91..3c5f45651 100644 --- a/src/Bundle/ChillEventBundle/migrations/Version20250505120818.php +++ b/src/Bundle/ChillEventBundle/migrations/Version20250505120818.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * 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. + */ + namespace Chill\Migrations\Event; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillEventBundle/migrations/Version20250506114531.php b/src/Bundle/ChillEventBundle/migrations/Version20250506114531.php index 0b28eb55c..798a168a5 100644 --- a/src/Bundle/ChillEventBundle/migrations/Version20250506114531.php +++ b/src/Bundle/ChillEventBundle/migrations/Version20250506114531.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * 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. + */ + namespace Chill\Migrations\Event; use Doctrine\DBAL\Schema\Schema; diff --git a/src/Bundle/ChillEventBundle/migrations/Version20250507073301.php b/src/Bundle/ChillEventBundle/migrations/Version20250507073301.php index e2c985a5f..942172061 100644 --- a/src/Bundle/ChillEventBundle/migrations/Version20250507073301.php +++ b/src/Bundle/ChillEventBundle/migrations/Version20250507073301.php @@ -2,6 +2,13 @@ declare(strict_types=1); +/* + * 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. + */ + namespace Chill\Migrations\Event; use Doctrine\DBAL\Schema\Schema;