Apply rector rules: symfony up to 54

This commit is contained in:
Julien Fastré 2024-04-04 23:30:25 +02:00
parent 1ee3b9e2f0
commit 579bd829f8
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
204 changed files with 974 additions and 2346 deletions

View File

@ -35,10 +35,13 @@ return static function (RectorConfig $rectorConfig): void {
//define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_82,
\Rector\Symfony\Set\SymfonyLevelSetList::UP_TO_SYMFONY_50,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_50,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_50_TYPES,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_51,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_52,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_53,
\Rector\Symfony\Set\SymfonySetList::SYMFONY_54,
\Rector\Doctrine\Set\DoctrineSetList::DOCTRINE_CODE_QUALITY,
\Rector\PHPUnit\Set\PHPUnitLevelSetList::UP_TO_PHPUNIT_90,
]);
// migrate for phpunit

View File

@ -73,9 +73,8 @@ final class ActivityController extends AbstractController
/**
* Deletes a Activity entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/delete", name="chill_activity_activity_delete", methods={"GET", "POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/delete', name: 'chill_activity_activity_delete', methods: ['GET', 'POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$view = null;
@ -143,9 +142,8 @@ final class ActivityController extends AbstractController
/**
* Displays a form to edit an existing Activity entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/edit", name="chill_activity_activity_edit", methods={"GET", "POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/edit', name: 'chill_activity_activity_edit', methods: ['GET', 'POST', 'PUT'])]
public function editAction(int $id, Request $request): Response
{
$view = null;
@ -238,9 +236,8 @@ final class ActivityController extends AbstractController
/**
* Lists all Activity entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/", name="chill_activity_activity_list")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/', name: 'chill_activity_activity_list')]
public function listAction(Request $request): Response
{
$view = null;
@ -344,9 +341,7 @@ final class ActivityController extends AbstractController
return $filterBuilder->build();
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/new", name="chill_activity_activity_new", methods={"POST", "GET"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/new', name: 'chill_activity_activity_new', methods: ['POST', 'GET'])]
public function newAction(Request $request): Response
{
$view = null;
@ -527,9 +522,7 @@ final class ActivityController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/select-type", name="chill_activity_activity_select_type")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/select-type', name: 'chill_activity_activity_select_type')]
public function selectTypeAction(Request $request): Response
{
$view = null;
@ -574,9 +567,7 @@ final class ActivityController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/activity/{id}/show", name="chill_activity_activity_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/activity/{id}/show', name: 'chill_activity_activity_show')]
public function showAction(Request $request, int $id): Response
{
$entity = $this->activityRepository->find($id);

View File

@ -26,9 +26,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Creates a new ActivityReasonCategory entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/create", name="chill_activity_activityreasoncategory_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/create', name: 'chill_activity_activityreasoncategory_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new ActivityReasonCategory();
@ -51,9 +50,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Displays a form to edit an existing ActivityReasonCategory entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/edit", name="chill_activity_activityreasoncategory_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/edit', name: 'chill_activity_activityreasoncategory_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -74,9 +72,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Lists all ActivityReasonCategory entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/", name="chill_activity_activityreasoncategory")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/', name: 'chill_activity_activityreasoncategory')]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -90,9 +87,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Displays a form to create a new ActivityReasonCategory entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/new", name="chill_activity_activityreasoncategory_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/new', name: 'chill_activity_activityreasoncategory_new')]
public function newAction()
{
$entity = new ActivityReasonCategory();
@ -106,9 +102,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Finds and displays a ActivityReasonCategory entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/show", name="chill_activity_activityreasoncategory_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/show', name: 'chill_activity_activityreasoncategory_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -126,9 +121,8 @@ class ActivityReasonCategoryController extends AbstractController
/**
* Edits an existing ActivityReasonCategory entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreasoncategory/{id}/update", name="chill_activity_activityreasoncategory_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreasoncategory/{id}/update', name: 'chill_activity_activityreasoncategory_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -28,9 +28,8 @@ class ActivityReasonController extends AbstractController
/**
* Creates a new ActivityReason entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/create", name="chill_activity_activityreason_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/create', name: 'chill_activity_activityreason_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new ActivityReason();
@ -53,9 +52,8 @@ class ActivityReasonController extends AbstractController
/**
* Displays a form to edit an existing ActivityReason entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/edit", name="chill_activity_activityreason_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/edit', name: 'chill_activity_activityreason_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -76,9 +74,8 @@ class ActivityReasonController extends AbstractController
/**
* Lists all ActivityReason entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/", name="chill_activity_activityreason")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/', name: 'chill_activity_activityreason')]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -92,9 +89,8 @@ class ActivityReasonController extends AbstractController
/**
* Displays a form to create a new ActivityReason entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/new", name="chill_activity_activityreason_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/new', name: 'chill_activity_activityreason_new')]
public function newAction()
{
$entity = new ActivityReason();
@ -108,9 +104,8 @@ class ActivityReasonController extends AbstractController
/**
* Finds and displays a ActivityReason entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/show", name="chill_activity_activityreason_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/show', name: 'chill_activity_activityreason_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -128,9 +123,8 @@ class ActivityReasonController extends AbstractController
/**
* Edits an existing ActivityReason entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activityreason/{id}/update", name="chill_activity_activityreason_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activityreason/{id}/update', name: 'chill_activity_activityreason_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -18,18 +18,14 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
*/
class AdminController extends AbstractController
{
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity", name="chill_activity_admin_index")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity', name: 'chill_activity_admin_index')]
public function indexActivityAction()
{
return $this->render('@ChillActivity/Admin/layout_activity.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_aside_activity_redirect_to_admin_index", options={null})
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/activity_redirect_to_main", name="chill_admin_activity_redirect_to_admin_index")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_aside_activity_redirect_to_admin_index', options: [null])]
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/activity_redirect_to_main', name: 'chill_admin_activity_redirect_to_admin_index')]
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@ -50,10 +50,6 @@ use Symfony\Component\Validator\Constraints as Assert;
*
* @ORM\HasLifecycleCallbacks
*
* @DiscriminatorMap(typeProperty="type", mapping={
* "activity": Activity::class
* })
*
* @ActivityValidator\ActivityValidity
*
* TODO see if necessary
@ -62,6 +58,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* getUserFunction="getUser",
* path="scope")
*/
#[DiscriminatorMap(typeProperty: 'type', mapping: ['activity' => Activity::class])]
class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterface, HasCentersInterface, HasScopesInterface, TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
@ -74,50 +71,43 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityType")
*
* @Groups({"read", "docgen:read"})
*
* @SerializedName("activityType")
*
* @ORM\JoinColumn(name="type_id")
*/
#[Groups(['read', 'docgen:read'])]
#[SerializedName('activityType')]
private ActivityType $activityType;
/**
* @ORM\ManyToOne(targetEntity="Chill\ActivityBundle\Entity\ActivityPresence")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?ActivityPresence $attendee = null;
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="datetime")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private \DateTime $date;
/**
* @ORM\ManyToMany(targetEntity="Chill\DocStoreBundle\Entity\StoredObject", cascade={"persist"})
*
* @Assert\Valid(traverse=true)
*
* @var Collection<StoredObject>
*/
#[Assert\Valid(traverse: true)]
private Collection $documents;
/**
@ -127,9 +117,8 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\Column(type="boolean", options={"default": false})
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private bool $emergency = false;
/**
@ -138,16 +127,14 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*
* @groups({"read", "docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private ?Location $location = null;
/**
@ -158,10 +145,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\PersonBundle\Entity\Person")
*
* @Groups({"read", "docgen:read"})
*
* @var Collection<Person>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $persons;
/**
@ -172,24 +158,21 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToMany(targetEntity="Chill\ActivityBundle\Entity\ActivityReason")
*
* @Groups({"docgen:read"})
*
* @var Collection<ActivityReason>
*/
#[Groups(['docgen:read'])]
private Collection $reasons;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Scope")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?Scope $scope = null;
/**
* @ORM\Column(type="string", options={"default": ""})
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private string $sentReceived = '';
/**
@ -197,10 +180,9 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
*
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialaction")
*
* @Groups({"read", "docgen:read"})
*
* @var Collection<SocialAction>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $socialActions;
/**
@ -208,19 +190,17 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
*
* @ORM\JoinTable(name="chill_activity_activity_chill_person_socialissue")
*
* @Groups({"read", "docgen:read"})
*
* @var Collection<SocialIssue>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $socialIssues;
/**
* @ORM\ManyToMany(targetEntity="Chill\ThirdPartyBundle\Entity\ThirdParty")
*
* @Groups({"read", "docgen:read"})
*
* @var Collection<ThirdParty>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $thirdParties;
/**
@ -230,18 +210,16 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?User $user = null;
/**
* @ORM\ManyToMany(targetEntity="Chill\MainBundle\Entity\User")
*
* @Groups({"read", "docgen:read"})
*
* @var Collection<User>
*/
#[Groups(['read', 'docgen:read'])]
private Collection $users;
public function __construct()
@ -385,9 +363,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this->documents;
}
/**
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
public function getDurationMinute(): int
{
if (null === $this->durationTime) {
@ -515,9 +491,7 @@ class Activity implements AccompanyingPeriodLinkedWithSocialIssuesEntityInterfac
return $this->travelTime;
}
/**
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
public function getTravelTimeMinute(): int
{
if (null === $this->travelTime) {

View File

@ -36,18 +36,16 @@ class ActivityPresence
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private array $name = [];
/**

View File

@ -50,9 +50,8 @@ class ActivityType
/**
* @ORM\Column(type="boolean")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private bool $active = true;
/**
@ -126,9 +125,8 @@ class ActivityType
* @ORM\Column(name="id", type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @Groups({"docgen:read"})
*/
#[Groups(['docgen:read'])]
private ?int $id = null;
/**
@ -144,10 +142,9 @@ class ActivityType
/**
* @ORM\Column(type="json")
*
* @Groups({"read", "docgen:read"})
*
* @Serializer\Context({"is-translatable": true}, groups={"docgen:read"})
*/
#[Groups(['read', 'docgen:read'])]
private array $name = [];
/**
@ -167,9 +164,8 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private int $personsVisible = self::FIELD_OPTIONAL;
/**
@ -248,9 +244,8 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private int $thirdPartiesVisible = self::FIELD_INVISIBLE;
/**
@ -275,9 +270,8 @@ class ActivityType
/**
* @ORM\Column(type="smallint", nullable=false, options={"default": 1})
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private int $usersVisible = self::FIELD_OPTIONAL;
/**
@ -285,9 +279,7 @@ class ActivityType
*/
private int $userVisible = self::FIELD_REQUIRED;
/**
* @Assert\Callback
*/
#[Assert\Callback]
public function checkSocialActionsVisibility(ExecutionContextInterface $context, mixed $payload)
{
if ($this->socialIssuesVisible !== $this->socialActionsVisible) {

View File

@ -19,9 +19,7 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin/aside-activity", name="chill_aside_activity_admin")
*/
#[Route(path: '/{_locale}/admin/aside-activity', name: 'chill_aside_activity_admin')]
public function indexAdminAction()
{
return $this->render('@ChillAsideActivity/Admin/index.html.twig');

View File

@ -29,9 +29,8 @@ class AsideActivity implements TrackCreationInterface, TrackUpdateInterface
* @ORM\ManyToOne(targetEntity=User::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Assert\NotBlank
*/
#[Assert\NotBlank]
private User $agent;
/**

View File

@ -117,9 +117,7 @@ class AsideActivityCategory
return null !== $this->parent;
}
/**
* @Assert\Callback
*/
#[Assert\Callback]
public function preventRecursiveParent(ExecutionContextInterface $context, mixed $payload)
{
if (!$this->hasParent()) {

View File

@ -16,9 +16,7 @@ use Symfony\Component\Routing\Annotation\Route;
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin/budget", name="chill_admin_budget")
*/
#[Route(path: '/{_locale}/admin/budget', name: 'chill_admin_budget')]
public function indexAdminAction()
{
return $this->render('@ChillBudget/Admin/index.html.twig');

View File

@ -21,9 +21,8 @@ class ChargeController extends AbstractElementController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/delete", name="chill_budget_charge_delete")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/delete', name: 'chill_budget_charge_delete')]
public function deleteAction(Request $request, Charge $charge)
{
return $this->_delete(
@ -36,9 +35,8 @@ class ChargeController extends AbstractElementController
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/edit", name="chill_budget_charge_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/edit', name: 'chill_budget_charge_edit')]
public function editAction(Request $request, Charge $charge)
{
return $this->_edit(
@ -51,9 +49,8 @@ class ChargeController extends AbstractElementController
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-person/{id}/new", name="chill_budget_charge_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-person/{id}/new', name: 'chill_budget_charge_new')]
public function newAction(Request $request, Person $person)
{
return $this->_new(
@ -66,9 +63,8 @@ class ChargeController extends AbstractElementController
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/by-household/{id}/new", name="chill_budget_charge_household_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/by-household/{id}/new', name: 'chill_budget_charge_household_new')]
public function newHouseholdAction(Request $request, Household $household)
{
return $this->_new(
@ -81,9 +77,8 @@ class ChargeController extends AbstractElementController
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/charge/{id}/view", name="chill_budget_charge_view")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/charge/{id}/view', name: 'chill_budget_charge_view')]
public function viewAction(Charge $charge)
{
return $this->_view($charge, '@ChillBudget/Charge/view.html.twig');

View File

@ -23,9 +23,7 @@ class ElementController extends AbstractController
{
public function __construct(private readonly CalculatorManager $calculator, private readonly ResourceRepository $resourceRepository, private readonly ChargeRepository $chargeRepository) {}
/**
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-person/{id}", name="chill_budget_elements_index")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-person/{id}', name: 'chill_budget_elements_index')]
public function indexAction(Person $person)
{
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $person);
@ -47,9 +45,7 @@ class ElementController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/elements/by-household/{id}", name="chill_budget_elements_household_index")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/elements/by-household/{id}', name: 'chill_budget_elements_household_index')]
public function indexHouseholdAction(Household $household)
{
$this->denyAccessUnlessGranted(BudgetElementVoter::SEE, $household);

View File

@ -20,9 +20,7 @@ use Symfony\Component\HttpFoundation\Response;
class ResourceController extends AbstractElementController
{
/**
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/delete", name="chill_budget_resource_delete")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/delete', name: 'chill_budget_resource_delete')]
public function deleteAction(Request $request, Resource $resource)
{
return $this->_delete(
@ -33,9 +31,7 @@ class ResourceController extends AbstractElementController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/edit", name="chill_budget_resource_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/edit', name: 'chill_budget_resource_edit')]
public function editAction(Request $request, Resource $resource): Response
{
return $this->_edit(
@ -48,9 +44,8 @@ class ResourceController extends AbstractElementController
/**
* Create a new budget element for a person.
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-person/{id}/new", name="chill_budget_resource_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-person/{id}/new', name: 'chill_budget_resource_new')]
public function newAction(Request $request, Person $person): Response
{
return $this->_new(
@ -63,9 +58,8 @@ class ResourceController extends AbstractElementController
/**
* Create new budget element for a household.
*
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/by-household/{id}/new", name="chill_budget_resource_household_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/by-household/{id}/new', name: 'chill_budget_resource_household_new')]
public function newHouseholdAction(Request $request, Household $household): Response
{
return $this->_new(
@ -76,9 +70,7 @@ class ResourceController extends AbstractElementController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route("{_locale}/budget/resource/{id}/view", name="chill_budget_resource_view")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '{_locale}/budget/resource/{id}/view', name: 'chill_budget_resource_view')]
public function viewAction(Resource $resource): Response
{
return $this->_view($resource, '@ChillBudget/Resource/view.html.twig');

View File

@ -27,15 +27,9 @@ abstract class AbstractElement
{
/**
* @ORM\Column(name="amount", type="decimal", precision=10, scale=2)
*
* @Assert\GreaterThan(
* value=0
* )
*
* @Assert\NotNull(
* message="The amount cannot be empty"
* )
*/
#[Assert\GreaterThan(value: 0)]
#[Assert\NotNull(message: 'The amount cannot be empty')]
private string $amount;
/**
@ -45,12 +39,8 @@ abstract class AbstractElement
/**
* @ORM\Column(name="endDate", type="datetime_immutable", nullable=true)
*
* @Assert\GreaterThan(
* propertyPath="startDate",
* message="The budget element's end date must be after the start date"
* )
*/
#[Assert\GreaterThan(propertyPath: 'startDate', message: "The budget element's end date must be after the start date")]
private ?\DateTimeImmutable $endDate = null;
/**
@ -69,9 +59,8 @@ abstract class AbstractElement
/**
* @ORM\Column(name="startDate", type="datetime_immutable")
*
* @Assert\Date
*/
#[Assert\Date]
private \DateTimeImmutable $startDate;
/**

View File

@ -23,9 +23,8 @@ use Symfony\Component\Validator\Constraints as Assert;
* )
*
* @ORM\Entity
*
* @UniqueEntity(fields={"kind"})
*/
#[UniqueEntity(fields: ['kind'])]
class ChargeKind
{
/**
@ -44,11 +43,9 @@ class ChargeKind
/**
* @ORM\Column(type="string", length=255, options={"default": ""}, nullable=false)
*
* @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric")
*
* @Assert\Length(min=3)
*/
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
#[Assert\Length(min: 3)]
private string $kind = '';
/**

View File

@ -22,11 +22,12 @@ use Symfony\Component\Validator\Constraints as Assert;
*
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
* })
* @ORM\UniqueConstraint(name="resource_kind_unique_type_idx", fields={"kind"})
* })
*
* @ORM\Entity
*
* @UniqueEntity(fields={"kind"})
*/
#[UniqueEntity(fields: ['kind'])]
class ResourceKind
{
/**
@ -45,11 +46,9 @@ class ResourceKind
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": ""})
*
* @Assert\Regex(pattern="/^[a-z0-9\-_]{1,}$/", message="budget.admin.form.kind.only_alphanumeric")
*
* @Assert\Length(min=3)
*/
#[Assert\Regex(pattern: '/^[a-z0-9\-_]{1,}$/', message: 'budget.admin.form.kind.only_alphanumeric')]
#[Assert\Length(min: 3)]
private string $kind = '';
/**

View File

@ -56,7 +56,7 @@ class AzureGrantAdminConsentAndAcquireToken extends Command
$messages = ['No problem, we will wait for you', 'Grant access and come back here'];
$output->writeln($formatter->formatBlock($messages, 'warning'));
return 0;
return Command::SUCCESS;
}
$token = $this->machineTokenStorage->getToken();
@ -69,6 +69,6 @@ class AzureGrantAdminConsentAndAcquireToken extends Command
$output->writeln('Expires at: '.$token->getExpires());
$output->writeln('To inspect the token content, go to https://jwt.ms/#access_token='.urlencode($token->getToken()));
return 0;
return Command::SUCCESS;
}
}

View File

@ -32,6 +32,8 @@ use Symfony\Component\Console\Output\OutputInterface;
final class MapAndSubscribeUserCalendarCommand extends Command
{
protected static $defaultDescription = 'MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence';
public function __construct(
private readonly EntityManagerInterface $em,
private readonly EventsOnUserSubscriptionCreator $eventsOnUserSubscriptionCreator,
@ -154,7 +156,7 @@ final class MapAndSubscribeUserCalendarCommand extends Command
$output->writeln('users synchronized');
return 0;
return Command::SUCCESS;
}
protected function configure()
@ -162,7 +164,6 @@ final class MapAndSubscribeUserCalendarCommand extends Command
parent::configure();
$this
->setDescription('MSGraph: collect user metadata and create subscription on events for users, and sync the user absence-presence')
->addOption(
'renew-before-end-interval',
'r',

View File

@ -34,6 +34,6 @@ class SendShortMessageOnEligibleCalendar extends Command
{
$this->messageSender->sendBulkMessageToEligibleCalendars();
return 0;
return Command::SUCCESS;
}
}

View File

@ -39,6 +39,8 @@ use Symfony\Component\Console\Question\Question;
class SendTestShortMessageOnCalendarCommand extends Command
{
protected static $defaultDescription = 'Test sending a SMS for a dummy calendar appointment';
public function __construct(
private readonly PersonRepository $personRepository,
private readonly PhoneNumberUtil $phoneNumberUtil,
@ -50,10 +52,7 @@ class SendTestShortMessageOnCalendarCommand extends Command
parent::__construct('chill:calendar:test-send-short-message');
}
protected function configure()
{
$this->setDescription('Test sending a SMS for a dummy calendar appointment');
}
protected function configure() {}
protected function execute(InputInterface $input, OutputInterface $output): int
{
@ -174,6 +173,6 @@ class SendTestShortMessageOnCalendarCommand extends Command
}
}
return 0;
return Command::SUCCESS;
}
}

View File

@ -18,9 +18,8 @@ class AdminController extends AbstractController
{
/**
* Calendar admin.
*
* @Route("/{_locale}/admin/calendar", name="chill_calendar_admin_index")
*/
#[Route(path: '/{_locale}/admin/calendar', name: 'chill_calendar_admin_index')]
public function indexAdminAction()
{
return $this->render('@ChillCalendar/Admin/index.html.twig');

View File

@ -25,12 +25,7 @@ class CalendarAPIController extends ApiController
{
public function __construct(private readonly CalendarRepository $calendarRepository) {}
/**
* @Route("/api/1.0/calendar/calendar/by-user/{id}.{_format}",
* name="chill_api_single_calendar_list_by-user",
* requirements={"_format": "json"}
* )
*/
#[Route(path: '/api/1.0/calendar/calendar/by-user/{id}.{_format}', name: 'chill_api_single_calendar_list_by-user', requirements: ['_format' => 'json'])]
public function listByUser(User $user, Request $request, string $_format): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -64,9 +64,8 @@ class CalendarController extends AbstractController
/**
* Delete a calendar item.
*
* @Route("/{_locale}/calendar/{id}/delete", name="chill_calendar_calendar_delete")
*/
#[Route(path: '/{_locale}/calendar/{id}/delete', name: 'chill_calendar_calendar_delete')]
public function deleteAction(Request $request, Calendar $entity)
{
$em = $this->managerRegistry->getManager();
@ -114,9 +113,8 @@ class CalendarController extends AbstractController
/**
* Edit a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/edit", name="chill_calendar_calendar_edit")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/edit', name: 'chill_calendar_calendar_edit')]
public function editAction(Calendar $entity, Request $request): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::EDIT, $entity);
@ -194,9 +192,8 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities.
*
* @Route("/{_locale}/calendar/calendar/by-period/{id}", name="chill_calendar_calendar_list_by_period")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-period/{id}', name: 'chill_calendar_calendar_list_by_period')]
public function listActionByCourse(AccompanyingPeriod $accompanyingPeriod): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $accompanyingPeriod);
@ -228,9 +225,8 @@ class CalendarController extends AbstractController
/**
* Lists all Calendar entities on a person.
*
* @Route("/{_locale}/calendar/calendar/by-person/{id}", name="chill_calendar_calendar_list_by_person")
*/
#[Route(path: '/{_locale}/calendar/calendar/by-person/{id}', name: 'chill_calendar_calendar_list_by_person')]
public function listActionByPerson(Person $person): Response
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $person);
@ -260,9 +256,7 @@ class CalendarController extends AbstractController
]);
}
/**
* @Route("/{_locale}/calendar/calendar/my", name="chill_calendar_calendar_list_my")
*/
#[Route(path: '/{_locale}/calendar/calendar/my', name: 'chill_calendar_calendar_list_my')]
public function myCalendar(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');
@ -284,9 +278,8 @@ class CalendarController extends AbstractController
/**
* Create a new calendar item.
*
* @Route("/{_locale}/calendar/calendar/new", name="chill_calendar_calendar_new")
*/
#[Route(path: '/{_locale}/calendar/calendar/new', name: 'chill_calendar_calendar_new')]
public function newAction(Request $request): Response
{
if (!$this->remoteCalendarConnector->isReady()) {
@ -385,9 +378,8 @@ class CalendarController extends AbstractController
/**
* Show a calendar item.
*
* @Route("/{_locale}/calendar/calendar/{id}/show", name="chill_calendar_calendar_show")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/show', name: 'chill_calendar_calendar_show')]
public function showAction(Request $request, int $id): Response
{
throw new \Exception('not implemented');
@ -455,9 +447,7 @@ class CalendarController extends AbstractController
]);
}
/**
* @Route("/{_locale}/calendar/calendar/{id}/to-activity", name="chill_calendar_calendar_to_activity")
*/
#[Route(path: '/{_locale}/calendar/calendar/{id}/to-activity', name: 'chill_calendar_calendar_to_activity')]
public function toActivity(Request $request, Calendar $calendar): RedirectResponse
{
$this->denyAccessUnlessGranted(CalendarVoter::SEE, $calendar);

View File

@ -37,9 +37,7 @@ final readonly class CalendarDocController
private UrlGeneratorInterface $urlGenerator,
) {}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/new", name="chill_calendar_calendardoc_new")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/new', name: 'chill_calendar_calendardoc_new')]
public function create(Calendar $calendar, Request $request): Response
{
$calendarDoc = (new CalendarDoc($calendar, null))->setCalendar($calendar);
@ -96,9 +94,7 @@ final readonly class CalendarDocController
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/delete", name="chill_calendar_calendardoc_delete")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/delete', name: 'chill_calendar_calendardoc_delete')]
public function delete(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {
@ -156,9 +152,7 @@ final readonly class CalendarDocController
);
}
/**
* @Route("/{_locale}/calendar/calendar-doc/{id}/edit", name="chill_calendar_calendardoc_edit")
*/
#[Route(path: '/{_locale}/calendar/calendar-doc/{id}/edit', name: 'chill_calendar_calendardoc_edit')]
public function edit(CalendarDoc $calendarDoc, Request $request): Response
{
if (!$this->security->isGranted(CalendarDocVoter::EDIT, $calendarDoc)) {

View File

@ -25,12 +25,7 @@ class CalendarRangeAPIController extends ApiController
{
public function __construct(private readonly CalendarRangeRepository $calendarRangeRepository) {}
/**
* @Route("/api/1.0/calendar/calendar-range-available/{id}.{_format}",
* name="chill_api_single_calendar_range_available",
* requirements={"_format": "json"}
* )
*/
#[Route(path: '/api/1.0/calendar/calendar-range-available/{id}.{_format}', name: 'chill_api_single_calendar_range_available', requirements: ['_format' => 'json'])]
public function availableRanges(User $user, Request $request, string $_format): JsonResponse
{
// return new JsonResponse(['ok' => true], 200, [], false);

View File

@ -38,9 +38,8 @@ class InviteApiController
/**
* Give an answer to a calendar invite.
*
* @Route("/api/1.0/calendar/calendar/{id}/answer/{answer}.json", methods={"post"})
*/
#[Route(path: '/api/1.0/calendar/calendar/{id}/answer/{answer}.json', methods: ['post'])]
public function answer(Calendar $calendar, string $answer): Response
{
$user = $this->security->getUser();

View File

@ -32,9 +32,7 @@ class RemoteCalendarConnectAzureController
{
public function __construct(private readonly ClientRegistry $clientRegistry, private readonly OnBehalfOfUserTokenStorage $MSGraphTokenStorage) {}
/**
* @Route("/{_locale}/connect/azure", name="chill_calendar_remote_connect_azure")
*/
#[Route(path: '/{_locale}/connect/azure', name: 'chill_calendar_remote_connect_azure')]
public function connectAzure(Request $request): Response
{
$request->getSession()->set('azure_return_path', $request->query->get('returnPath', '/'));
@ -44,9 +42,7 @@ class RemoteCalendarConnectAzureController
->redirect(['https://graph.microsoft.com/.default', 'offline_access'], []);
}
/**
* @Route("/connect/azure/check", name="chill_calendar_remote_connect_azure_check")
*/
#[Route(path: '/connect/azure/check', name: 'chill_calendar_remote_connect_azure_check')]
public function connectAzureCheck(Request $request): Response
{
/** @var Azure $client */

View File

@ -29,10 +29,7 @@ class RemoteCalendarMSGraphSyncController
{
public function __construct(private readonly MessageBusInterface $messageBus) {}
/**
* @Route("/public/incoming-hook/calendar/msgraph/events/{userId}", name="chill_calendar_remote_msgraph_incoming_webhook_events",
* methods={"POST"})
*/
#[Route(path: '/public/incoming-hook/calendar/msgraph/events/{userId}', name: 'chill_calendar_remote_msgraph_incoming_webhook_events', methods: ['POST'])]
public function webhookCalendarReceiver(int $userId, Request $request): Response
{
if ($request->query->has('validationToken')) {

View File

@ -36,9 +36,7 @@ class RemoteCalendarProxyController
{
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly RemoteCalendarConnectorInterface $remoteCalendarConnector, private readonly SerializerInterface $serializer) {}
/**
* @Route("api/1.0/calendar/proxy/calendar/by-user/{id}/events")
*/
#[Route(path: 'api/1.0/calendar/proxy/calendar/by-user/{id}/events')]
public function listEventForCalendar(User $user, Request $request): Response
{
if (!$request->query->has('dateFrom')) {

View File

@ -43,11 +43,8 @@ use Symfony\Component\Validator\Mapping\ClassMetadata;
* )
*
* @ORM\Entity
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "chill_calendar_calendar": Calendar::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['chill_calendar_calendar' => Calendar::class])]
class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCentersInterface
{
use RemoteCalendarTrait;
@ -91,9 +88,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\AccompanyingPeriod", inversedBy="calendars")
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
@ -103,9 +99,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\OneToOne(targetEntity="CalendarRange", inversedBy="calendar")
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
private ?CalendarRange $calendarRange = null;
/**
@ -115,9 +110,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\Embedded(class=CommentEmbeddable::class, columnPrefix="comment_")
*
* @Serializer\Groups({"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'docgen:read'])]
private CommentEmbeddable $comment;
/**
@ -134,11 +128,9 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Assert\NotNull(message="calendar.An end date is required")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.An end date is required')]
private ?\DateTimeImmutable $endDate = null;
/**
@ -147,9 +139,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
private ?int $id = null;
/**
@ -162,30 +153,25 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_invites")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @var Collection&Selectable<int, Invite>
*/
#[Serializer\Groups(['read', 'docgen:read'])]
private Collection&Selectable $invites;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Location")
*
* @Serializer\Groups({"read", "docgen:read"})
*
* @Assert\NotNull(message="calendar.A location is required")
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A location is required')]
private ?Location $location = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\NotNull(message="calendar.A main user is mandatory")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A main user is mandatory')]
private ?User $mainUser = null;
/**
@ -200,21 +186,18 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_persons")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\Count(min=1, minMessage="calendar.At least {{ limit }} person is required.")
*
* @var Collection<Person>
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\Count(min: 1, minMessage: 'calendar.At least {{ limit }} person is required.')]
private Collection $persons;
/**
* @ORM\Embedded(class=PrivateCommentEmbeddable::class, columnPrefix="privateComment_")
*
* @Serializer\Groups({"calendar:read"})
*/
#[Serializer\Groups(['calendar:read'])]
private PrivateCommentEmbeddable $privateComment;
/**
@ -224,17 +207,15 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
*
* @ORM\JoinTable(name="chill_calendar.calendar_to_thirdparties")
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
private Collection $professionals;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?bool $sendSMS = false;
/**
@ -245,28 +226,24 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light", "docgen:read"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*
* @Assert\NotNull(message="calendar.A start date is required")
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
#[Assert\NotNull(message: 'calendar.A start date is required')]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\Column(type="string", length=255, nullable=false, options={"default": "valid"})
*
* @Serializer\Groups({"calendar:read", "read", "calendar:light"})
*
* @Serializer\Context(normalizationContext={"read"}, groups={"calendar:light"})
*/
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light'])]
private string $status = self::STATUS_VALID;
/**
* @ORM\Column(type="boolean", nullable=true)
*
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
private ?bool $urgent = false;
public function __construct()
@ -394,9 +371,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
return $this->documents;
}
/**
* @Serializer\Groups({"docgen:read"})
*/
#[Serializer\Groups(['docgen:read'])]
public function getDuration(): ?\DateInterval
{
if (null === $this->getStartDate() || null === $this->getEndDate()) {
@ -541,9 +516,8 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @return ReadableCollection<(int|string), User>
*
* @Serializer\Groups({"calendar:read", "read"})
*/
#[Serializer\Groups(['calendar:read', 'read'])]
public function getUsers(): ReadableCollection
{
return $this->getInvites()->map(static fn (Invite $i) => $i->getUser());

View File

@ -16,17 +16,11 @@ use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocCreateDTO
{
/**
* @Assert\NotNull
*
* @Assert\Valid
*/
#[Assert\NotNull]
#[Assert\Valid]
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Assert\NotBlank]
#[Assert\NotNull]
public ?string $title = '';
}

View File

@ -17,16 +17,11 @@ use Symfony\Component\Validator\Constraints as Assert;
class CalendarDocEditDTO
{
/**
* @Assert\Valid
*/
#[Assert\Valid]
public ?StoredObject $doc = null;
/**
* @Assert\NotBlank
*
* @Assert\NotNull
*/
#[Assert\NotBlank]
#[Assert\NotNull]
public ?string $title = '';
public function __construct(CalendarDoc $calendarDoc)

View File

@ -44,11 +44,9 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
private ?\DateTimeImmutable $endDate = null;
/**
@ -57,38 +55,31 @@ class CalendarRange implements TrackCreationInterface, TrackUpdateInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Groups({"read"})
*/
#[Groups(['read'])]
private ?int $id = null;
/**
* @ORM\ManyToOne(targetEntity=Location::class)
*
* @ORM\JoinColumn(nullable=false)
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
private ?Location $location = null;
/**
* @ORM\Column(type="datetime_immutable", nullable=false)
*
* @groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
private ?\DateTimeImmutable $startDate = null;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @Groups({"read", "write", "calendar:read"})
*
* @Assert\NotNull
*/
#[Groups(['read', 'write', 'calendar:read'])]
#[Assert\NotNull]
private ?User $user = null;
public function getCalendar(): ?Calendar

View File

@ -69,25 +69,22 @@ class Invite implements TrackUpdateInterface, TrackCreationInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups(groups={"calendar:read", "read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read'])]
private ?int $id = null;
/**
* @ORM\Column(type="text", nullable=false, options={"default": "pending"})
*
* @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
private string $status = self::PENDING;
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\User")
*
* @ORM\JoinColumn(nullable=false)
*
* @Serializer\Groups(groups={"calendar:read", "read", "docgen:read"})
*/
#[Serializer\Groups(groups: ['calendar:read', 'read', 'docgen:read'])]
private ?User $user = null;
public function getCalendar(): ?Calendar

View File

@ -23,26 +23,16 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class RemoteEvent
{
public function __construct(
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $id,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $title,
public string $description,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public \DateTimeImmutable $startDate,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public \DateTimeImmutable $endDate,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public bool $isAllDay = false
) {}
}

View File

@ -31,6 +31,7 @@ use Symfony\Component\Yaml\Parser;
*/
class CreateFieldsOnGroupCommand extends Command
{
protected static $defaultDescription = 'Create custom fields from a yml file';
final public const ARG_DELETE = 'delete';
final public const ARG_PATH = 'path';
@ -51,7 +52,6 @@ class CreateFieldsOnGroupCommand extends Command
protected function configure()
{
$this->setName('chill:custom_fields:populate_group')
->setDescription('Create custom fields from a yml file')
->addArgument(
self::ARG_PATH,
InputOption::VALUE_REQUIRED,
@ -130,7 +130,7 @@ class CreateFieldsOnGroupCommand extends Command
$fields = $this->_addFields($customFieldsGroup, $fieldsInput, $output);
return 0;
return Command::SUCCESS;
}
private function _addFields(CustomFieldsGroup $group, $values, OutputInterface $output)

View File

@ -21,9 +21,7 @@ use Symfony\Component\Routing\Annotation\Route;
*/
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin/customfield/", name="customfield_section")
*/
#[Route(path: '/{_locale}/admin/customfield/', name: 'customfield_section')]
public function indexAction(): Response
{
return $this->render('@ChillCustomFields/Admin/layout.html.twig');

View File

@ -33,9 +33,8 @@ class CustomFieldController extends AbstractController
/**
* Creates a new CustomField entity.
*
* @Route("/{_locale}/admin/customfield/new", name="customfield_create")
*/
#[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_create')]
public function createAction(Request $request)
{
$entity = new CustomField();
@ -64,9 +63,8 @@ class CustomFieldController extends AbstractController
/**
* Displays a form to edit an existing CustomField entity.
*
* @Route("/{_locale}/admin/customfield/edit", name="customfield_edit")
*/
#[Route(path: '/{_locale}/admin/customfield/edit', name: 'customfield_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -87,9 +85,8 @@ class CustomFieldController extends AbstractController
/**
* Displays a form to create a new CustomField entity.
*
* @Route("/{_locale}/admin/customfield/new", name="customfield_new")
*/
#[Route(path: '/{_locale}/admin/customfield/new', name: 'customfield_new')]
public function newAction(Request $request)
{
$entity = new CustomField();
@ -118,9 +115,8 @@ class CustomFieldController extends AbstractController
/**
* Edits an existing CustomField entity.
*
* @Route("/{_locale}/admin/customfield/update", name="customfield_update")
*/
#[Route(path: '/{_locale}/admin/customfield/update', name: 'customfield_update')]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -44,9 +44,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Creates a new CustomFieldsGroup entity.
*
* @Route("/{_locale}/admin/customfieldsgroup/create", name="customfieldsgroup_create")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/create', name: 'customfieldsgroup_create')]
public function createAction(Request $request)
{
$entity = new CustomFieldsGroup();
@ -75,9 +74,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Displays a form to edit an existing CustomFieldsGroup entity.
*
* @Route("/{_locale}/admin/customfieldsgroup/{id}/edit", name="customfieldsgroup_edit")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/edit', name: 'customfieldsgroup_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -98,9 +96,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Lists all CustomFieldsGroup entities.
*
* @Route("/{_locale}/admin/customfieldsgroup/", name="customfieldsgroup")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/', name: 'customfieldsgroup')]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -125,9 +122,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Set the CustomField Group with id $cFGroupId as default.
*
* @Route("/{_locale}/admin/customfieldsgroup/makedefault", name="customfieldsgroup_makedefault")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/makedefault', name: 'customfieldsgroup_makedefault')]
public function makeDefaultAction(Request $request)
{
$form = $this->createMakeDefaultForm(null);
@ -170,9 +166,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Displays a form to create a new CustomFieldsGroup entity.
*
* @Route("/{_locale}/admin/customfieldsgroup/new", name="customfieldsgroup_new")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/new', name: 'customfieldsgroup_new')]
public function newAction()
{
$entity = new CustomFieldsGroup();
@ -235,9 +230,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Finds and displays a CustomFieldsGroup entity.
*
* @Route("/{_locale}/admin/customfieldsgroup/{id}/show", name="customfieldsgroup_show")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/show', name: 'customfieldsgroup_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -259,9 +253,8 @@ class CustomFieldsGroupController extends AbstractController
/**
* Edits an existing CustomFieldsGroup entity.
*
* @Route("/{_locale}/admin/customfieldsgroup/{id}/update", name="customfieldsgroup_update")
*/
#[Route(path: '/{_locale}/admin/customfieldsgroup/{id}/update', name: 'customfieldsgroup_update')]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -58,9 +58,7 @@ class AdminDocGeneratorTemplateController extends CRUDController
return parent::new($request);
}
/**
* @Route("{_locale}/admin/docgen/template/pick-context", name="chill_docgen_admin_template_pick-context")
*/
#[Route(path: '{_locale}/admin/docgen/template/pick-context', name: 'chill_docgen_admin_template_pick-context')]
public function pickContext(Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_ADMIN');

View File

@ -51,12 +51,7 @@ final class DocGeneratorTemplateController extends AbstractController
private readonly ChillSecurity $security
) {}
/**
* @Route(
* "{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}",
* name="chill_docgenerator_test_generate_from_template"
* )
*/
#[Route(path: '{_locale}/admin/doc/gen/generate/test/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_test_generate_from_template')]
public function adminTestGenerateDocFromTemplateAction(
DocGeneratorTemplate $template,
string $entityClassName,
@ -71,12 +66,7 @@ final class DocGeneratorTemplateController extends AbstractController
);
}
/**
* @Route(
* "{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}",
* name="chill_docgenerator_generate_from_template"
* )
*/
#[Route(path: '{_locale}/doc/gen/generate/from/{template}/for/{entityClassName}/{entityId}', name: 'chill_docgenerator_generate_from_template')]
public function generateDocFromTemplateAction(
DocGeneratorTemplate $template,
string $entityClassName,
@ -91,12 +81,7 @@ final class DocGeneratorTemplateController extends AbstractController
);
}
/**
* @Route(
* "/api/1.0/docgen/templates/by-entity/{entityClassName}",
* name="chill_docgenerator_templates_for_entity_api"
* )
*/
#[Route(path: '/api/1.0/docgen/templates/by-entity/{entityClassName}', name: 'chill_docgenerator_templates_for_entity_api')]
public function listTemplateApiAction(string $entityClassName): Response
{
$nb = $this->docGeneratorTemplateRepository->countByEntity($entityClassName);
@ -116,13 +101,9 @@ final class DocGeneratorTemplateController extends AbstractController
}
/**
* @Route(
* "{_locale}/admin/doc/gen/generate/test/redirect",
* name="chill_docgenerator_test_generate_redirect"
* )
*
* @return void
*/
#[Route(path: '{_locale}/admin/doc/gen/generate/test/redirect', name: 'chill_docgenerator_test_generate_redirect')]
public function redirectToTestGenerate(Request $request): RedirectResponse
{
$template = $request->query->getInt('template');

View File

@ -19,11 +19,8 @@ use Symfony\Component\Serializer\Annotation as Serializer;
* @ORM\Entity
*
* @ORM\Table(name="chill_docgen_template")
*
* @Serializer\DiscriminatorMap(typeProperty="type", mapping={
* "docgen_template": DocGeneratorTemplate::class
* })
*/
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['docgen_template' => DocGeneratorTemplate::class])]
class DocGeneratorTemplate
{
/**
@ -43,9 +40,8 @@ class DocGeneratorTemplate
/**
* @ORM\Column(type="text", nullable=true)
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?string $description = null;
/**
@ -66,16 +62,14 @@ class DocGeneratorTemplate
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private ?int $id = null;
/**
* @ORM\Column(type="json")
*
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
private array $name = [];
/**

View File

@ -238,10 +238,9 @@ final class DocGenObjectNormalizerTest extends KernelTestCase
class TestableParentClass
{
/**
* @Serializer\Groups("docgen:read")
*
* @Serializer\Context(normalizationContext={"groups": "docgen:read:foo"}, groups={"docgen:read"})
*/
#[Serializer\Groups('docgen:read')]
public ?TestableChildClass $child;
public function __construct()
@ -252,27 +251,19 @@ class TestableParentClass
class TestableChildClass
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public string $baz = 'bloup';
/**
* @Serializer\Groups("docgen:read:foo")
*/
#[Serializer\Groups('docgen:read:foo')]
public string $foo = 'bar';
}
class TestableClassWithBool
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public bool $foo;
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public function getThing(): bool
{
return true;
@ -281,9 +272,7 @@ class TestableClassWithBool
class TestableWithIntersectionReadableCollection
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public ReadableCollection&Selectable $collection;
public function __construct()
@ -294,9 +283,7 @@ class TestableWithIntersectionReadableCollection
class TestableWithCollection
{
/**
* @Serializer\Groups("docgen:read")
*/
#[Serializer\Groups('docgen:read')]
public Collection&Selectable $collection;
public function __construct()

View File

@ -21,6 +21,7 @@ use Symfony\Contracts\HttpClient\HttpClientInterface;
class ConfigureOpenstackObjectStorageCommand extends Command
{
protected static $defaultDescription = 'Configure openstack container to store documents';
private readonly string $basePath;
private readonly string $tempUrlKey;
@ -37,7 +38,7 @@ class ConfigureOpenstackObjectStorageCommand extends Command
protected function configure()
{
$this->setDescription('Configure openstack container to store documents')
$this
->setName('chill:doc-store:configure-openstack')
->addOption('os_token', 'o', InputOption::VALUE_REQUIRED, 'Openstack token')
->addOption('domain', 'd', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Domain name')
@ -85,6 +86,6 @@ class ConfigureOpenstackObjectStorageCommand extends Command
}
}
return 0;
return Command::SUCCESS;
}
}

View File

@ -16,21 +16,14 @@ use Symfony\Component\Serializer\Annotation as Serializer;
readonly class SignedUrl
{
public function __construct(
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $method,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $url,
public \DateTimeImmutable $expires,
) {}
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public function getExpires(): int
{
return $this->expires->getTimestamp();

View File

@ -18,35 +18,17 @@ readonly class SignedUrlPost extends SignedUrl
public function __construct(
string $url,
\DateTimeImmutable $expires,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public int $max_file_size,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public int $max_file_count,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public int $submit_delay,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $redirect,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $prefix,
/**
* @Serializer\Groups({"read"})
*/
#[Serializer\Groups(['read'])]
public string $signature,
) {
parent::__construct('POST', $url, $expires);

View File

@ -20,9 +20,8 @@ class AdminController extends AbstractController
{
/**
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document", name="chill_docstore_admin", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document', name: 'chill_docstore_admin', options: [null])]
public function indexAction()
{
return $this->render('@ChillDocStore/Admin/layout.html.twig');
@ -30,9 +29,8 @@ class AdminController extends AbstractController
/**
* @return \Symfony\Component\HttpFoundation\RedirectResponse
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/document_redirect_to_main", name="chill_docstore_admin_redirect_to_admin_index", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/document_redirect_to_main', name: 'chill_docstore_admin_redirect_to_admin_index', options: [null])]
public function redirectToAdminIndexAction()
{
return $this->redirectToRoute('chill_main_admin_central');

View File

@ -33,10 +33,7 @@ final readonly class AsyncUploadController
private LoggerInterface $logger,
) {}
/**
* @Route("/asyncupload/temp_url/generate/{method}",
* name="async_upload.generate_url")
*/
#[Route(path: '/asyncupload/temp_url/generate/{method}', name: 'async_upload.generate_url')]
public function getSignedUrl(string $method, Request $request): JsonResponse
{
try {

View File

@ -25,9 +25,7 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @Route("/{_locale}/parcours/{course}/document")
*/
#[Route(path: '/{_locale}/parcours/{course}/document')]
class DocumentAccompanyingCourseController extends AbstractController
{
/**
@ -40,9 +38,7 @@ class DocumentAccompanyingCourseController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @Route("/{id}/delete", name="chill_docstore_accompanying_course_document_delete")
*/
#[Route(path: '/{id}/delete', name: 'chill_docstore_accompanying_course_document_delete')]
public function delete(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::DELETE, $document);
@ -75,9 +71,7 @@ class DocumentAccompanyingCourseController extends AbstractController
);
}
/**
* @Route("/{id}/edit", name="accompanying_course_document_edit", methods="GET|POST")
*/
#[Route(path: '/{id}/edit', name: 'accompanying_course_document_edit', methods: 'GET|POST')]
public function edit(Request $request, AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::UPDATE, $document);
@ -116,9 +110,7 @@ class DocumentAccompanyingCourseController extends AbstractController
);
}
/**
* @Route("/new", name="accompanying_course_document_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'accompanying_course_document_new', methods: 'GET|POST')]
public function new(Request $request, AccompanyingPeriod $course): Response
{
if (null === $course) {
@ -162,9 +154,7 @@ class DocumentAccompanyingCourseController extends AbstractController
]);
}
/**
* @Route("/{id}", name="accompanying_course_document_show", methods="GET")
*/
#[Route(path: '/{id}', name: 'accompanying_course_document_show', methods: 'GET')]
public function show(AccompanyingPeriod $course, AccompanyingCourseDocument $document): Response
{
$this->denyAccessUnlessGranted(AccompanyingCourseDocumentVoter::SEE_DETAILS, $document);

View File

@ -20,16 +20,12 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
/**
* @Route("/{_locale}/admin/document/category")
*/
#[Route(path: '/{_locale}/admin/document/category')]
class DocumentCategoryController extends AbstractController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/{bundleId}/{idInsideBundle}", name="document_category_delete", methods="DELETE")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_delete', methods: 'DELETE')]
public function delete(Request $request, mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();
@ -47,9 +43,7 @@ class DocumentCategoryController extends AbstractController
return $this->redirectToRoute('document_category_index');
}
/**
* @Route("/{bundleId}/{idInsideBundle}/edit", name="document_category_edit", methods="GET|POST")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}/edit', name: 'document_category_edit', methods: 'GET|POST')]
public function edit(Request $request, mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();
@ -76,9 +70,8 @@ class DocumentCategoryController extends AbstractController
]);
}
/**
* @Route("/", name="document_category_index", methods="GET")
* @Route("/", name="chill_docstore_category_admin", methods="GET") */
#[Route(path: '/', name: 'document_category_index', methods: 'GET')]
#[Route(path: '/', name: 'chill_docstore_category_admin', methods: 'GET')]
public function index(): Response
{
$em = $this->managerRegistry->getManager();
@ -92,9 +85,7 @@ class DocumentCategoryController extends AbstractController
);
}
/**
* @Route("/new", name="document_category_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'document_category_new', methods: 'GET|POST')]
public function new(Request $request): Response
{
$em = $this->managerRegistry->getManager();
@ -130,9 +121,7 @@ class DocumentCategoryController extends AbstractController
]);
}
/**
* @Route("/{bundleId}/{idInsideBundle}", name="document_category_show", methods="GET")
*/
#[Route(path: '/{bundleId}/{idInsideBundle}', name: 'document_category_show', methods: 'GET')]
public function show(mixed $bundleId, mixed $idInsideBundle): Response
{
$em = $this->managerRegistry->getManager();

View File

@ -29,11 +29,8 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/**
* Class DocumentPersonController.
*
* @Route("/{_locale}/person/{person}/document")
*
* TODO faire un controller abstrait ?
*/
#[Route(path: '/{_locale}/person/{person}/document')] // TODO faire un controller abstrait ?
class DocumentPersonController extends AbstractController
{
/**
@ -46,9 +43,7 @@ class DocumentPersonController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @Route("/{id}/delete", name="chill_docstore_person_document_delete")
*/
#[Route(path: '/{id}/delete', name: 'chill_docstore_person_document_delete')]
public function delete(Request $request, Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted(PersonDocumentVoter::DELETE, $document);
@ -81,9 +76,7 @@ class DocumentPersonController extends AbstractController
);
}
/**
* @Route("/{id}/edit", name="person_document_edit", methods="GET|POST")
*/
#[Route(path: '/{id}/edit', name: 'person_document_edit', methods: 'GET|POST')]
public function edit(Request $request, Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);
@ -140,9 +133,7 @@ class DocumentPersonController extends AbstractController
);
}
/**
* @Route("/new", name="person_document_new", methods="GET|POST")
*/
#[Route(path: '/new', name: 'person_document_new', methods: 'GET|POST')]
public function new(Request $request, Person $person): Response
{
if (null === $person) {
@ -188,9 +179,7 @@ class DocumentPersonController extends AbstractController
]);
}
/**
* @Route("/{id}", name="person_document_show", methods="GET")
*/
#[Route(path: '/{id}', name: 'person_document_show', methods: 'GET')]
public function show(Person $person, PersonDocument $document): Response
{
$this->denyAccessUnlessGranted('CHILL_PERSON_SEE', $person);

View File

@ -33,9 +33,8 @@ final readonly class GenericDocForAccompanyingPeriodController
/**
* @throws \Doctrine\DBAL\Exception
*
* @Route("/{_locale}/doc-store/generic-doc/by-period/{id}/index", name="chill_docstore_generic-doc_by-period_index")
*/
#[Route(path: '/{_locale}/doc-store/generic-doc/by-period/{id}/index', name: 'chill_docstore_generic-doc_by-period_index')]
public function list(AccompanyingPeriod $accompanyingPeriod): Response
{
if (!$this->security->isGranted(AccompanyingCourseDocumentVoter::SEE, $accompanyingPeriod)) {

View File

@ -33,9 +33,8 @@ final readonly class GenericDocForPerson
/**
* @throws \Doctrine\DBAL\Exception
*
* @Route("/{_locale}/doc-store/generic-doc/by-person/{id}/index", name="chill_docstore_generic-doc_by-person_index")
*/
#[Route(path: '/{_locale}/doc-store/generic-doc/by-person/{id}/index', name: 'chill_docstore_generic-doc_by-person_index')]
public function list(Person $person): Response
{
if (!$this->security->isGranted(PersonDocumentVoter::SEE, $person)) {

View File

@ -22,9 +22,7 @@ class StoredObjectApiController
{
public function __construct(private readonly Security $security) {}
/**
* @Route("/api/1.0/doc-store/stored-object/{uuid}/is-ready")
*/
#[Route(path: '/api/1.0/doc-store/stored-object/{uuid}/is-ready')]
public function isDocumentReady(StoredObject $storedObject): Response
{
if (!$this->security->isGranted('ROLE_USER')) {

View File

@ -54,13 +54,9 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
* targetEntity="Chill\DocStoreBundle\Entity\StoredObject",
* cascade={"persist"}
* )
*
* @Assert\Valid
*
* @Assert\NotNull(
* message="Upload a document"
* )
*/
#[Assert\Valid]
#[Assert\NotNull(message: 'Upload a document')]
private ?StoredObject $object = null;
/**
@ -70,11 +66,8 @@ class Document implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Column(type="text")
*
* @Assert\Length(
* min=2, max=250
* )
*/
#[Assert\Length(min: 2, max: 250)]
private string $title = '';
/**

View File

@ -46,16 +46,14 @@ class StoredObject implements Document, TrackCreationInterface
/**
* @ORM\Column(type="json", name="datas")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private array $datas = [];
/**
* @ORM\Column(type="text")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private string $filename = '';
/**
@ -64,46 +62,40 @@ class StoredObject implements Document, TrackCreationInterface
* @ORM\GeneratedValue
*
* @ORM\Column(type="integer")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private ?int $id = null;
/**
* @var int[]
*
* @ORM\Column(type="json", name="iv")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private array $iv = [];
/**
* @ORM\Column(type="json", name="key")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private array $keyInfos = [];
/**
* @ORM\Column(type="text", name="title")
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private string $title = '';
/**
* @ORM\Column(type="text", name="type", options={"default": ""})
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private string $type = '';
/**
* @ORM\Column(type="uuid", unique=true)
*
* @Serializer\Groups({"read", "write"})
*/
#[Serializer\Groups(['read', 'write'])]
private UuidInterface $uuid;
/**
@ -135,10 +127,9 @@ class StoredObject implements Document, TrackCreationInterface
* @param StoredObject::STATUS_* $status
*/
public function __construct(/**
* @ORM\Column(type="text", options={"default": "ready"})
*
* @Serializer\Groups({"read"})
*/
* @ORM\Column(type="text", options={"default": "ready"})
*/
#[Serializer\Groups(['read'])]
private string $status = 'ready'
) {
$this->uuid = Uuid::uuid4();
@ -152,10 +143,9 @@ class StoredObject implements Document, TrackCreationInterface
}
/**
* @Serializer\Groups({"read", "write"})
*
* @deprecated
*/
#[Serializer\Groups(['read', 'write'])]
public function getCreationDate(): \DateTime
{
if (null === $this->createdAt) {
@ -233,10 +223,9 @@ class StoredObject implements Document, TrackCreationInterface
}
/**
* @Serializer\Groups({"write"})
*
* @deprecated
*/
#[Serializer\Groups(['write'])]
public function setCreationDate(\DateTime $creationDate): self
{
$this->createdAt = \DateTimeImmutable::createFromMutable($creationDate);

View File

@ -22,9 +22,8 @@ class AdminController extends AbstractController
{
/**
* Event admin.
*
* @Route("/{_locale}/admin/event", name="chill_event_admin_index")
*/
#[Route(path: '/{_locale}/admin/event', name: 'chill_event_admin_index')]
public function indexAdminAction()
{
return $this->render('@ChillEvent/Admin/index.html.twig');

View File

@ -60,9 +60,7 @@ final class EventController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/delete", name="chill_event__event_delete", requirements={"event_id"="\d+"}, methods={"GET", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/delete', name: 'chill_event__event_delete', requirements: ['event_id' => '\d+'], methods: ['GET', 'DELETE'])]
public function deleteAction($event_id, Request $request): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();
@ -113,9 +111,11 @@ final class EventController extends AbstractController
* Displays a form to edit an existing Event entity.
*
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/edit", name="chill_event__event_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/edit', name: 'chill_event__event_edit')]
public function editAction($event_id)
{
$em = $this->managerRegistry->getManager();
@ -140,9 +140,11 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Doctrine\ORM\NonUniqueResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{person_id}/list", name="chill_event__list_by_person", methods={"GET"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{person_id}/list', name: 'chill_event__list_by_person', methods: ['GET'])]
public function listByPersonAction($person_id)
{
$em = $this->managerRegistry->getManager();
@ -188,9 +190,7 @@ final class EventController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/most_recent", name="chill_event_list_most_recent", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/most_recent', name: 'chill_event_list_most_recent', options: [null])]
public function mostRecentIndexAction()
{
return $this->redirectToRoute('chill_main_search', [
@ -202,9 +202,11 @@ final class EventController extends AbstractController
* Displays a form to create a new Event entity.
*
* @return \Symfony\Component\HttpFoundation\Response
* @return \Symfony\Component\HttpFoundation\Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new", name="chill_event__event_new", methods={"GET", "POST"})
*/
#[\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)
{
$user = $this->security->getUser();
@ -244,9 +246,8 @@ final class EventController extends AbstractController
/**
* First step of new Event form.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/new/pick-center", name="chill_event__event_new_pickcenter", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/new/pick-center', name: 'chill_event__event_new_pickcenter', options: [null])]
public function newPickCenterAction()
{
$role = 'CHILL_EVENT_CREATE';
@ -294,9 +295,11 @@ final class EventController extends AbstractController
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \PhpOffice\PhpSpreadsheet\Exception
* @throws \PhpOffice\PhpSpreadsheet\Exception
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/show", name="chill_event__event_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/show', name: 'chill_event__event_show')]
public function showAction(Event $event, Request $request)
{
if (!$event) {
@ -326,9 +329,8 @@ final class EventController extends AbstractController
/**
* Edits an existing Event entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/event/{event_id}/update", name="chill_event__event_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/event/{event_id}/update', name: 'chill_event__event_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, $event_id): \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
{
$em = $this->managerRegistry->getManager();

View File

@ -42,9 +42,7 @@ final readonly class EventListController
private UrlGeneratorInterface $urlGenerator,
) {}
/**
* @Route("{_locale}/event/event/list", name="chill_event_event_list")
*/
#[Route(path: '{_locale}/event/event/list', name: 'chill_event_event_list')]
public function __invoke(): Response
{
$filter = $this->buildFilterOrder();

View File

@ -26,9 +26,8 @@ class EventTypeController extends AbstractController
/**
* Creates a new EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/create", name="chill_eventtype_admin_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/create', name: 'chill_eventtype_admin_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new EventType();
@ -51,9 +50,8 @@ class EventTypeController extends AbstractController
/**
* Deletes a EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/delete", name="chill_eventtype_admin_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/delete', name: 'chill_eventtype_admin_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@ -76,9 +74,8 @@ class EventTypeController extends AbstractController
/**
* Displays a form to edit an existing EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/edit", name="chill_eventtype_admin_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/edit', name: 'chill_eventtype_admin_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -101,9 +98,8 @@ class EventTypeController extends AbstractController
/**
* Lists all EventType entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/", name="chill_eventtype_admin", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/', name: 'chill_eventtype_admin', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -117,9 +113,8 @@ class EventTypeController extends AbstractController
/**
* Displays a form to create a new EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/new", name="chill_eventtype_admin_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/new', name: 'chill_eventtype_admin_new')]
public function newAction()
{
$entity = new EventType();
@ -133,9 +128,8 @@ class EventTypeController extends AbstractController
/**
* Finds and displays a EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/show", name="chill_eventtype_admin_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/show', name: 'chill_eventtype_admin_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -156,9 +150,8 @@ class EventTypeController extends AbstractController
/**
* Edits an existing EventType entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/event_type/{id}/update", name="chill_eventtype_admin_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/event_type/{id}/update', name: 'chill_eventtype_admin_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -44,9 +44,7 @@ final class ParticipationController extends AbstractController
private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/create", name="chill_event_participation_create")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/create', name: 'chill_event_participation_create')]
public function createAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
// test the request is correct
@ -243,9 +241,8 @@ final class ParticipationController extends AbstractController
/**
* @param int $participation_id
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/delete", name="chill_event_participation_delete", requirements={"participation_id"="\d+"}, methods={"GET", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/delete', name: 'chill_event_participation_delete', requirements: ['participation_id' => '\d+'], methods: ['GET', 'DELETE'])]
public function deleteAction($participation_id, Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$em = $this->managerRegistry->getManager();
@ -292,9 +289,11 @@ final class ParticipationController extends AbstractController
*
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException if the participation is not found
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
* @throws \Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException if the user is not allowed to edit the participation
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/edit", name="chill_event_participation_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/edit', name: 'chill_event_participation_edit')]
public function editAction(int $participation_id): Response
{
/** @var Participation $participation */
@ -324,9 +323,11 @@ final class ParticipationController extends AbstractController
* show a form to edit multiple participation for the same event.
*
* @param int $event_id
* @param int $event_id
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/edit_multiple", name="chill_event_participation_edit_multiple")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/edit_multiple', name: 'chill_event_participation_edit_multiple')]
public function editMultipleAction($event_id): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
$event = $this->managerRegistry->getRepository(Event::class)
@ -381,9 +382,8 @@ final class ParticipationController extends AbstractController
* This function parse the person_id / persons_ids query argument
* and decide if it should process a single or multiple participation. Depending
* on this, the appropriate layout and form.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/new", name="chill_event_participation_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/new', name: 'chill_event_participation_new')]
public function newAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
// test the request is correct
@ -416,9 +416,7 @@ final class ParticipationController extends AbstractController
."'persons_ids' argument in query");
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{participation_id}/update", name="chill_event_participation_update", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{participation_id}/update', name: 'chill_event_participation_update', methods: ['POST'])]
public function updateAction(int $participation_id, Request $request): Response
{
/** @var Participation $participation */
@ -460,9 +458,7 @@ final class ParticipationController extends AbstractController
]);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/event/participation/{event_id}/update_multiple", name="chill_event_participation_update_multiple", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/event/participation/{event_id}/update_multiple', name: 'chill_event_participation_update_multiple', methods: ['POST'])]
public function updateMultipleAction(mixed $event_id, Request $request)
{
/** @var Event $event */

View File

@ -26,9 +26,8 @@ class RoleController extends AbstractController
/**
* Creates a new Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/create", name="chill_event_admin_role_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/create', name: 'chill_event_admin_role_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new Role();
@ -51,9 +50,8 @@ class RoleController extends AbstractController
/**
* Deletes a Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/delete", name="chill_event_admin_role_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/delete', name: 'chill_event_admin_role_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@ -76,9 +74,8 @@ class RoleController extends AbstractController
/**
* Displays a form to edit an existing Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/edit", name="chill_event_admin_role_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/edit', name: 'chill_event_admin_role_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -101,9 +98,8 @@ class RoleController extends AbstractController
/**
* Lists all Role entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/", name="chill_event_admin_role", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/', name: 'chill_event_admin_role', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -117,9 +113,8 @@ class RoleController extends AbstractController
/**
* Displays a form to create a new Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/new", name="chill_event_admin_role_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/new', name: 'chill_event_admin_role_new')]
public function newAction()
{
$entity = new Role();
@ -133,9 +128,8 @@ class RoleController extends AbstractController
/**
* Finds and displays a Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/show", name="chill_event_admin_role_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/show', name: 'chill_event_admin_role_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -156,9 +150,8 @@ class RoleController extends AbstractController
/**
* Edits an existing Role entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/role/{id}/update", name="chill_event_admin_role_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/role/{id}/update', name: 'chill_event_admin_role_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -26,9 +26,8 @@ class StatusController extends AbstractController
/**
* Creates a new Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/create", name="chill_event_admin_status_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/create', name: 'chill_event_admin_status_create', methods: ['POST'])]
public function createAction(Request $request)
{
$entity = new Status();
@ -51,9 +50,8 @@ class StatusController extends AbstractController
/**
* Deletes a Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/delete", name="chill_event_admin_status_delete", methods={"POST", "DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/delete', name: 'chill_event_admin_status_delete', methods: ['POST', 'DELETE'])]
public function deleteAction(Request $request, mixed $id)
{
$form = $this->createDeleteForm($id);
@ -76,9 +74,8 @@ class StatusController extends AbstractController
/**
* Displays a form to edit an existing Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/edit", name="chill_event_admin_status_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/edit', name: 'chill_event_admin_status_edit')]
public function editAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -101,9 +98,8 @@ class StatusController extends AbstractController
/**
* Lists all Status entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/", name="chill_event_admin_status", options={null})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/', name: 'chill_event_admin_status', options: [null])]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -117,9 +113,8 @@ class StatusController extends AbstractController
/**
* Displays a form to create a new Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/new", name="chill_event_admin_status_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/new', name: 'chill_event_admin_status_new')]
public function newAction()
{
$entity = new Status();
@ -133,9 +128,8 @@ class StatusController extends AbstractController
/**
* Finds and displays a Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/show", name="chill_event_admin_status_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/show', name: 'chill_event_admin_status_show')]
public function showAction(mixed $id)
{
$em = $this->managerRegistry->getManager();
@ -156,9 +150,8 @@ class StatusController extends AbstractController
/**
* Edits an existing Status entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/event/status/{id}/update", name="chill_event_admin_status_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/event/status/{id}/update', name: 'chill_event_admin_status_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, mixed $id)
{
$em = $this->managerRegistry->getManager();

View File

@ -45,9 +45,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\ManyToOne(targetEntity="Chill\MainBundle\Entity\Center")A
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Center $center = null;
/**
@ -76,9 +75,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\Column(type="string", length=150)
*
* @Assert\NotBlank()
*/
#[Assert\NotBlank]
private ?string $name = null;
/**
@ -92,9 +90,8 @@ class Event implements HasCenterInterface, HasScopeInterface, TrackCreationInter
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\EventType")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?EventType $type = null;
/**

View File

@ -34,11 +34,12 @@ use Symfony\Component\Validator\Context\ExecutionContextInterface;
*
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
* @ORM\UniqueConstraint(name="chill_event_participation_event_person_unique_idx", columns={"event_id", "person_id"})
* })
*
* @ORM\HasLifecycleCallbacks
*
* @UniqueEntity({"event", "person"}, message="event.validation.person_already_participate_to_event")
*/
#[UniqueEntity(['event', 'person'], message: 'event.validation.person_already_participate_to_event')]
class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterface, TrackUpdateInterface, TrackCreationInterface
{
use TrackCreationTrait;
@ -62,9 +63,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
/**
* @ORM\ManyToOne(targetEntity="Chill\PersonBundle\Entity\Person")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Person $person = null;
/**
@ -74,9 +74,8 @@ class Participation implements \ArrayAccess, HasCenterInterface, HasScopeInterfa
/**
* @ORM\ManyToOne(targetEntity="Chill\EventBundle\Entity\Status")
*
* @Assert\NotNull()
*/
#[Assert\NotNull]
private ?Status $status = null;
public function getCenter()

View File

@ -27,12 +27,12 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class ChillImportUsersCommand extends Command
{
protected static $defaultDescription = 'Import users from csv file';
/**
* Centers and aliases.
*
@ -55,7 +55,7 @@ class ChillImportUsersCommand extends Command
public function __construct(
protected EntityManagerInterface $em,
protected LoggerInterface $logger,
protected UserPasswordEncoderInterface $passwordEncoder,
protected \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder,
protected ValidatorInterface $validator,
protected UserRepository $userRepository
) {
@ -86,7 +86,6 @@ class ChillImportUsersCommand extends Command
protected function configure()
{
$this
->setDescription('Import users from csv file')
->setHelp("Import users from a csv file. Users are added to centers contained in the file. Headers are used to detect columns. Adding to multiple centers can be done by using a `grouping centers` file, which will group multiple centers into a signle alias, used in 'centers' column.")
->addArgument('csvfile', InputArgument::REQUIRED, 'Path to the csv file. Columns are: `username`, `email`, `center` (can contain alias), `permission group`')
->addOption('grouping-centers', null, InputOption::VALUE_OPTIONAL, 'Path to a csv file to aggregate multiple centers into a single alias')
@ -130,7 +129,7 @@ class ChillImportUsersCommand extends Command
->setEmail(\trim((string) $data['email']))
->setUsername(\trim((string) $data['username']))
->setEnabled(true)
->setPassword($this->passwordEncoder->encodePassword(
->setPassword($this->passwordEncoder->hashPassword(
$user,
\bin2hex(\random_bytes(32))
));
@ -207,7 +206,7 @@ class ChillImportUsersCommand extends Command
throw $e;
}
return 0;
return Command::SUCCESS;
}
/**

View File

@ -29,6 +29,7 @@ use Symfony\Component\EventDispatcher\EventDispatcherInterface;
*/
class ChillUserSendRenewPasswordCodeCommand extends Command
{
protected static $defaultDescription = 'Send a message with code to recover password';
/**
* @var EntityManagerInterface
*/
@ -82,7 +83,6 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
{
$this
->setName('chill:user:send-password-recover-code')
->setDescription('Send a message with code to recover password')
->addArgument('csvfile', InputArgument::REQUIRED, 'CSV file with the list of users')
->addOption('template', null, InputOption::VALUE_REQUIRED, 'Template for email')
->addOption('expiration', null, InputOption::VALUE_REQUIRED, 'Expiration of the link, as an unix timestamp')
@ -108,7 +108,7 @@ class ChillUserSendRenewPasswordCodeCommand extends Command
$this->sendRecoverCode($user);
}
return 0;
return Command::SUCCESS;
}
/**

View File

@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class ExecuteCronJobCommand extends Command
{
protected static $defaultDescription = 'Execute the cronjob(s) given as argument, or one cronjob scheduled by system.';
public function __construct(
private readonly CronManagerInterface $cronManager
) {
@ -28,7 +30,6 @@ class ExecuteCronJobCommand extends Command
protected function configure()
{
$this
->setDescription('Execute the cronjob(s) given as argument, or one cronjob scheduled by system.')
->setHelp("If no job is specified, the next available cronjob will be executed by system.\nThis command should be execute every 15 minutes (more or less)")
->addArgument('job', InputArgument::OPTIONAL | InputArgument::IS_ARRAY, 'one or more job to force execute (by default, all jobs are executed)', [])
->addUsage('');
@ -39,13 +40,13 @@ class ExecuteCronJobCommand extends Command
if ([] === $input->getArgument('job')) {
$this->cronManager->run();
return 0;
return Command::SUCCESS;
}
foreach ($input->getArgument('job') as $jobName) {
$this->cronManager->run($jobName);
}
return 0;
return Command::SUCCESS;
}
}

View File

@ -20,6 +20,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesBEFromBestAddressCommand extends Command
{
protected static $defaultDescription = 'Import BE addresses from BeST Address (see https://osoc19.github.io/best/)';
public function __construct(
private readonly AddressReferenceBEFromBestAddress $addressImporter,
private readonly PostalCodeBEFromBestAddress $postalCodeBEFromBestAddressImporter
@ -32,8 +34,7 @@ class LoadAddressesBEFromBestAddressCommand extends Command
$this
->setName('chill:main:address-ref-from-best-addresses')
->addArgument('lang', InputArgument::REQUIRED, "Language code, for example 'fr'")
->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)")
->setDescription('Import BE addresses from BeST Address (see https://osoc19.github.io/best/)');
->addArgument('list', InputArgument::IS_ARRAY, "The list to add, for example 'full', or 'extract' (dev) or '1xxx' (brussel CP)");
}
protected function execute(InputInterface $input, OutputInterface $output): int
@ -42,6 +43,6 @@ class LoadAddressesBEFromBestAddressCommand extends Command
$this->addressImporter->import($input->getArgument('lang'), $input->getArgument('list'));
return 0;
return Command::SUCCESS;
}
}

View File

@ -19,6 +19,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadAddressesFRFromBANOCommand extends Command
{
protected static $defaultDescription = 'Import FR addresses from bano (see https://bano.openstreetmap.fr';
public function __construct(private readonly AddressReferenceFromBano $addressReferenceFromBano)
{
parent::__construct();
@ -27,8 +29,7 @@ class LoadAddressesFRFromBANOCommand extends Command
protected function configure()
{
$this->setName('chill:main:address-ref-from-bano')
->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers')
->setDescription('Import FR addresses from bano (see https://bano.openstreetmap.fr');
->addArgument('departementNo', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'a list of departement numbers');
}
protected function execute(InputInterface $input, OutputInterface $output): int
@ -39,6 +40,6 @@ class LoadAddressesFRFromBANOCommand extends Command
$this->addressReferenceFromBano->import($departementNo);
}
return 0;
return Command::SUCCESS;
}
}

View File

@ -54,8 +54,6 @@ class LoadAndUpdateLanguagesCommand extends Command
{
$this
->setName('chill:main:languages:populate')
->setDescription('Load or update languages in db. This command does not delete existing '.
'languages, but will update names according to available languages')
->addOption(
self::INCLUDE_REGIONAL_VERSION,
null,
@ -122,6 +120,6 @@ class LoadAndUpdateLanguagesCommand extends Command
$em->flush();
return 0;
return Command::SUCCESS;
}
}

View File

@ -55,9 +55,7 @@ class LoadCountriesCommand extends Command
*/
protected function configure()
{
$this->setName('chill:main:countries:populate')
->setDescription('Load or update countries in db. This command does not delete existing countries, '.
'but will update names according to available languages');
$this->setName('chill:main:countries:populate');
}
/**
@ -83,6 +81,6 @@ class LoadCountriesCommand extends Command
$em->flush();
return 0;
return Command::SUCCESS;
}
}

View File

@ -18,6 +18,8 @@ use Symfony\Component\Console\Output\OutputInterface;
class LoadPostalCodeFR extends Command
{
protected static $defaultDescription = 'Load France\'s postal code from online open data';
public function __construct(private readonly PostalCodeFRFromOpenData $loader)
{
parent::__construct();
@ -25,14 +27,13 @@ class LoadPostalCodeFR extends Command
public function configure(): void
{
$this->setName('chill:main:postal-code:load:FR')
->setDescription('Load France\'s postal code from online open data');
$this->setName('chill:main:postal-code:load:FR');
}
public function execute(InputInterface $input, OutputInterface $output): int
{
$this->loader->import();
return 0;
return Command::SUCCESS;
}
}

View File

@ -25,6 +25,8 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
class LoadPostalCodesCommand extends Command
{
protected static $defaultDescription = 'Add the postal code from a csv file.';
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly ValidatorInterface $validator)
{
parent::__construct();
@ -33,7 +35,6 @@ class LoadPostalCodesCommand extends Command
protected function configure()
{
$this->setName('chill:main:postal-code:populate')
->setDescription('Add the postal code from a csv file.')
->setHelp('This script will try to avoid existing postal code '
."using the postal code and name. \n"
.'The CSV file must have the following columns: '
@ -101,7 +102,7 @@ class LoadPostalCodesCommand extends Command
$output->writeln('<info>'.$num.' were added !</info>');
return 0;
return Command::SUCCESS;
}
private function addPostalCode($row, OutputInterface $output)

View File

@ -18,13 +18,14 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Security\Core\Encoder\EncoderFactory;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
/**
* Class SetPasswordCommand.
*/
class SetPasswordCommand extends Command
{
protected static $defaultDescription = 'set a password to user';
/**
* SetPasswordCommand constructor.
*/
@ -42,7 +43,7 @@ class SetPasswordCommand extends Command
public function _setPassword(User $user, $password)
{
$defaultEncoder = new MessageDigestPasswordEncoder('sha512', true, 5000);
$defaultEncoder = new \Symfony\Component\PasswordHasher\Hasher\MessageDigestPasswordHasher('sha512', true, 5000);
$encoders = [
User::class => $defaultEncoder,
];
@ -56,7 +57,6 @@ class SetPasswordCommand extends Command
public function configure()
{
$this->setName('chill:user:set_password')
->setDescription('set a password to user')
->addArgument('username', InputArgument::REQUIRED, 'the user\'s '
.'username you want to change password')
->addArgument('password', InputArgument::OPTIONAL, 'the new password');
@ -80,6 +80,6 @@ class SetPasswordCommand extends Command
$this->_setPassword($user, $password);
return 0;
return Command::SUCCESS;
}
}

View File

@ -18,22 +18,20 @@ use Symfony\Component\Console\Output\OutputInterface;
class SynchronizeEntityInfoViewsCommand extends Command
{
protected static $defaultDescription = 'Update or create sql views which provide info for various entities';
public function __construct(
private readonly ViewEntityInfoManager $viewEntityInfoManager,
) {
parent::__construct('chill:db:sync-views');
}
protected function configure(): void
{
$this
->setDescription('Update or create sql views which provide info for various entities');
}
protected function configure(): void {}
protected function execute(InputInterface $input, OutputInterface $output): int
{
$this->viewEntityInfoManager->synchronizeOnDB();
return 0;
return Command::SUCCESS;
}
}

View File

@ -21,13 +21,7 @@ class AbsenceController extends AbstractController
{
public function __construct(private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route(
* "/{_locale}/absence",
* name="chill_main_user_absence_index",
* methods={"GET", "POST"}
* )
*/
#[Route(path: '/{_locale}/absence', name: 'chill_main_user_absence_index', methods: ['GET', 'POST'])]
public function setAbsence(Request $request)
{
$user = $this->security->getUser();
@ -48,13 +42,7 @@ class AbsenceController extends AbstractController
]);
}
/**
* @Route(
* "/{_locale}/absence/unset",
* name="chill_main_user_absence_unset",
* methods={"GET", "POST"}
* )
*/
#[Route(path: '/{_locale}/absence/unset', name: 'chill_main_user_absence_unset', methods: ['GET', 'POST'])]
public function unsetAbsence(Request $request)
{
$user = $this->security->getUser();

View File

@ -24,10 +24,8 @@ class AddressApiController extends ApiController
/**
* Duplicate an existing address.
*
* @Route("/api/1.0/main/address/{id}/duplicate.json", name="chill_api_main_address_duplicate",
* methods={"POST"})
*/
#[Route(path: '/api/1.0/main/address/{id}/duplicate.json', name: 'chill_api_main_address_duplicate', methods: ['POST'])]
public function duplicate(Address $address): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -28,9 +28,7 @@ final class AddressReferenceAPIController extends ApiController
{
public function __construct(private readonly AddressReferenceRepository $addressReferenceRepository, private readonly PaginatorFactory $paginatorFactory) {}
/**
* @Route("/api/1.0/main/address-reference/by-postal-code/{id}/search.json")
*/
#[Route(path: '/api/1.0/main/address-reference/by-postal-code/{id}/search.json')]
public function search(PostalCode $postalCode, Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -25,9 +25,7 @@ class AddressToReferenceMatcherController
{
public function __construct(private readonly Security $security, private readonly EntityManagerInterface $entityManager, private readonly SerializerInterface $serializer) {}
/**
* @Route("/api/1.0/main/address/reference-match/{id}/set/reviewed", methods={"POST"})
*/
#[Route(path: '/api/1.0/main/address/reference-match/{id}/set/reviewed', methods: ['POST'])]
public function markAddressAsReviewed(Address $address): JsonResponse
{
if (!$this->security->isGranted('ROLE_USER')) {
@ -48,9 +46,8 @@ class AddressToReferenceMatcherController
/**
* Set an address back to "to review". Only if the address is in "reviewed" state.
*
* @Route("/api/1.0/main/address/reference-match/{id}/set/to_review", methods={"POST"})
*/
#[Route(path: '/api/1.0/main/address/reference-match/{id}/set/to_review', methods: ['POST'])]
public function markAddressAsToReview(Address $address): JsonResponse
{
if (!$this->security->isGranted('ROLE_USER')) {
@ -73,9 +70,7 @@ class AddressToReferenceMatcherController
);
}
/**
* @Route("/api/1.0/main/address/reference-match/{id}/sync-with-reference", methods={"POST"})
*/
#[Route(path: '/api/1.0/main/address/reference-match/{id}/sync-with-reference', methods: ['POST'])]
public function syncAddressWithReference(Address $address): JsonResponse
{
if (null === $address->getAddressReference()) {

View File

@ -16,41 +16,31 @@ use Symfony\Component\Routing\Annotation\Route;
class AdminController extends AbstractController
{
/**
* @Route("/{_locale}/admin", name="chill_main_admin_central")
*/
#[Route(path: '/{_locale}/admin', name: 'chill_main_admin_central')]
public function indexAction()
{
return $this->render('@ChillMain/Admin/index.html.twig');
}
/**
* @Route("/{_locale}/admin/language", name="chill_main_language_admin")
*/
#[Route(path: '/{_locale}/admin/language', name: 'chill_main_language_admin')]
public function indexLanguageAction()
{
return $this->render('@ChillMain/Admin/indexLanguage.html.twig');
}
/**
* @Route("/{_locale}/admin/location", name="chill_main_location_admin")
*/
#[Route(path: '/{_locale}/admin/location', name: 'chill_main_location_admin')]
public function indexLocationAction()
{
return $this->render('@ChillMain/Admin/indexLocation.html.twig');
}
/**
* @Route("/{_locale}/admin/user", name="chill_main_user_admin")
*/
#[Route(path: '/{_locale}/admin/user', name: 'chill_main_user_admin')]
public function indexUserAction()
{
return $this->render('@ChillMain/Admin/indexUser.html.twig');
}
/**
* @Route("/{_locale}/admin/dashboard", name="chill_main_dashboard_admin")
*/
#[Route(path: '/{_locale}/admin/dashboard', name: 'chill_main_dashboard_admin')]
public function indexDashboardAction()
{
return $this->render('@ChillMain/Admin/indexDashboard.html.twig');

View File

@ -24,9 +24,8 @@ final readonly class DashboardApiController
/**
* Get user dashboard config (not yet based on user id and still hardcoded for now).
*
* @Route("/api/1.0/main/dashboard-config-item.json", methods={"get"})
*/
#[Route(path: '/api/1.0/main/dashboard-config-item.json', methods: ['get'])]
public function getDashboardConfiguration(): JsonResponse
{
$data = [];

View File

@ -18,9 +18,7 @@ use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
*/
class DefaultController extends AbstractController
{
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/homepage", name="chill_main_homepage")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/homepage', name: 'chill_main_homepage')]
public function indexAction()
{
if ($this->isGranted('ROLE_ADMIN')) {
@ -30,9 +28,7 @@ class DefaultController extends AbstractController
return $this->render('@ChillMain/layout.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/homepage", name="chill_main_homepage_without_locale")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/homepage', name: 'chill_main_homepage_without_locale')]
public function indexWithoutLocaleAction()
{
return $this->redirectToRoute('chill_main_homepage');

View File

@ -65,9 +65,7 @@ class ExportController extends AbstractController
$this->filterStatsByCenters = $parameterBag->get('chill_main')['acl']['filter_stats_by_center'];
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/download/{alias}", name="chill_main_export_download", methods={"GET"})
*/
#[Route(path: '/{_locale}/exports/download/{alias}', name: 'chill_main_export_download', methods: ['GET'])]
public function downloadResultAction(Request $request, mixed $alias)
{
/** @var ExportManager $exportManager */
@ -109,9 +107,11 @@ class ExportController extends AbstractController
* @param string $alias
*
* @return Response
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/generate/{alias}", name="chill_main_export_generate", methods={"GET"})
*/
#[Route(path: '/{_locale}/exports/generate/{alias}', name: 'chill_main_export_generate', methods: ['GET'])]
public function generateAction(Request $request, $alias)
{
/** @var ExportManager $exportManager */
@ -130,10 +130,9 @@ class ExportController extends AbstractController
}
/**
* @Route("/{_locale}/exports/generate-from-saved/{id}", name="chill_main_export_generate_from_saved")
*
* @throws \RedisException
*/
#[Route(path: '/{_locale}/exports/generate-from-saved/{id}', name: 'chill_main_export_generate_from_saved')]
public function generateFromSavedExport(SavedExport $savedExport): RedirectResponse
{
$this->denyAccessUnlessGranted(SavedExportVoter::GENERATE, $savedExport);
@ -154,9 +153,8 @@ class ExportController extends AbstractController
/**
* Render the list of available exports.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/", name="chill_main_export_index")
*/
#[Route(path: '/{_locale}/exports/', name: 'chill_main_export_index')]
public function indexAction(): Response
{
$exportManager = $this->exportManager;
@ -179,9 +177,8 @@ class ExportController extends AbstractController
* stored in the session (if valid), and then a redirection is done to next step.
* 3. 'generate': gather data from session from the previous steps, and
* make a redirection to the "generate" action with data in query (HTTP GET)
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/exports/new/{alias}", name="chill_main_export_new")
*/
#[Route(path: '/{_locale}/exports/new/{alias}', name: 'chill_main_export_new')]
public function newAction(Request $request, string $alias): Response
{
// first check for ACL
@ -205,9 +202,7 @@ class ExportController extends AbstractController
};
}
/**
* @Route("/{_locale}/export/saved/update-from-key/{id}/{key}", name="chill_main_export_saved_edit_options_from_key")
*/
#[Route(path: '/{_locale}/export/saved/update-from-key/{id}/{key}', name: 'chill_main_export_saved_edit_options_from_key')]
public function editSavedExportOptionsFromKey(SavedExport $savedExport, string $key): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');
@ -227,9 +222,7 @@ class ExportController extends AbstractController
return $this->redirectToRoute('chill_main_export_saved_edit', ['id' => $savedExport->getId()]);
}
/**
* @Route("/{_locale}/export/save-from-key/{alias}/{key}", name="chill_main_export_save_from_key")
*/
#[Route(path: '/{_locale}/export/save-from-key/{alias}/{key}', name: 'chill_main_export_save_from_key')]
public function saveFromKey(string $alias, string $key, Request $request): Response
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -26,9 +26,7 @@ class GeographicalUnitByAddressApiController
{
public function __construct(private readonly PaginatorFactory $paginatorFactory, private readonly GeographicalUnitRepositoryInterface $geographicalUnitRepository, private readonly Security $security, private readonly SerializerInterface $serializer) {}
/**
* @Route("/api/1.0/main/geographical-unit/by-address/{id}.{_format}", requirements={"_format": "json"})
*/
#[Route(path: '/api/1.0/main/geographical-unit/by-address/{id}.{_format}', requirements: ['_format' => 'json'])]
public function getGeographicalUnitCoveringAddress(Address $address): JsonResponse
{
if (!$this->security->isGranted('ROLE_USER')) {

View File

@ -35,9 +35,11 @@ class LoginController extends AbstractController
* Show a login form.
*
* @return Response
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/login", name="login")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/login', name: 'login')]
public function loginAction(Request $request)
{
return $this->render('@ChillMain/Login/login.html.twig', [

View File

@ -29,9 +29,8 @@ class NewsItemApiController
/**
* Get list of news items filtered on start and end date.
*
* @Route("/api/1.0/main/news/current.json", methods={"get"})
*/
#[Route(path: '/api/1.0/main/news/current.json', methods: ['get'])]
public function listCurrentNewsItems(): JsonResponse
{
$total = $this->newsItemRepository->countCurrentNews();

View File

@ -30,9 +30,7 @@ final readonly class NewsItemHistoryController
private readonly Environment $environment,
) {}
/**
* @Route("/{_locale}/news-items/history", name="chill_main_news_items_history")
*/
#[Route(path: '/{_locale}/news-items/history', name: 'chill_main_news_items_history')]
public function list(): Response
{
$filter = $this->buildFilterOrder();
@ -48,9 +46,7 @@ final readonly class NewsItemHistoryController
]));
}
/**
* @Route("/{_locale}/news-items/{id}", name="chill_main_single_news_item")
*/
#[Route(path: '/{_locale}/news-items/{id}', name: 'chill_main_single_news_item')]
public function showSingleItem(NewsItem $newsItem, Request $request): Response
{
return new Response($this->environment->render(

View File

@ -26,32 +26,24 @@ use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Security\Core\Security;
use Symfony\Component\Serializer\SerializerInterface;
/**
* @Route("/api/1.0/main/notification")
*/
#[Route(path: '/api/1.0/main/notification')]
class NotificationApiController
{
public function __construct(private readonly EntityManagerInterface $entityManager, private readonly NotificationRepository $notificationRepository, private readonly PaginatorFactory $paginatorFactory, private readonly Security $security, private readonly SerializerInterface $serializer) {}
/**
* @Route("/{id}/mark/read", name="chill_api_main_notification_mark_read", methods={"POST"})
*/
#[Route(path: '/{id}/mark/read', name: 'chill_api_main_notification_mark_read', methods: ['POST'])]
public function markAsRead(Notification $notification): JsonResponse
{
return $this->markAs('read', $notification);
}
/**
* @Route("/{id}/mark/unread", name="chill_api_main_notification_mark_unread", methods={"POST"})
*/
#[Route(path: '/{id}/mark/unread', name: 'chill_api_main_notification_mark_unread', methods: ['POST'])]
public function markAsUnread(Notification $notification): JsonResponse
{
return $this->markAs('unread', $notification);
}
/**
* @Route("/my/unread")
*/
#[Route(path: '/my/unread')]
public function myUnreadNotifications(Request $request): JsonResponse
{
$total = $this->notificationRepository->countUnreadByUser($this->security->getUser());

View File

@ -35,16 +35,12 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Contracts\Translation\TranslatorInterface;
use function in_array;
/**
* @Route("/{_locale}/notification")
*/
#[Route(path: '/{_locale}/notification')]
class NotificationController extends AbstractController
{
public function __construct(private readonly EntityManagerInterface $em, private readonly LoggerInterface $chillLogger, private readonly LoggerInterface $logger, private readonly ChillSecurity $security, private readonly NotificationRepository $notificationRepository, private readonly NotificationHandlerManager $notificationHandlerManager, private readonly PaginatorFactory $paginatorFactory, private readonly TranslatorInterface $translator, private readonly UserRepository $userRepository, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @Route("/create", name="chill_main_notification_create")
*/
#[Route(path: '/create', name: 'chill_main_notification_create')]
public function createAction(Request $request): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
@ -102,9 +98,7 @@ class NotificationController extends AbstractController
]);
}
/**
* @Route("/{id}/edit", name="chill_main_notification_edit")
*/
#[Route(path: '/{id}/edit', name: 'chill_main_notification_edit')]
public function editAction(Notification $notification, Request $request): Response
{
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_UPDATE, $notification);
@ -132,9 +126,7 @@ class NotificationController extends AbstractController
]);
}
/**
* @Route("/{id}/access_key", name="chill_main_notification_grant_access_by_access_key")
*/
#[Route(path: '/{id}/access_key', name: 'chill_main_notification_grant_access_by_access_key')]
public function getAccessByAccessKey(Notification $notification, Request $request): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
@ -174,9 +166,7 @@ class NotificationController extends AbstractController
return $this->redirectToRoute('chill_main_notification_show', ['id' => $notification->getId()]);
}
/**
* @Route("/inbox", name="chill_main_notification_my")
*/
#[Route(path: '/inbox', name: 'chill_main_notification_my')]
public function inboxAction(): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
@ -200,9 +190,7 @@ class NotificationController extends AbstractController
]);
}
/**
* @Route("/sent", name="chill_main_notification_sent")
*/
#[Route(path: '/sent', name: 'chill_main_notification_sent')]
public function sentAction(): Response
{
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_REMEMBERED');
@ -226,9 +214,7 @@ class NotificationController extends AbstractController
]);
}
/**
* @Route("/{id}/show", name="chill_main_notification_show")
*/
#[Route(path: '/{id}/show', name: 'chill_main_notification_show')]
public function showAction(Notification $notification, Request $request): Response
{
$this->denyAccessUnlessGranted(NotificationVoter::NOTIFICATION_SEE, $notification);

View File

@ -27,7 +27,6 @@ use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\Validator\Constraints\Callback;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Symfony\Contracts\Translation\TranslatorInterface;
@ -40,21 +39,18 @@ final class PasswordController extends AbstractController
/**
* PasswordController constructor.
*/
public function __construct(private readonly LoggerInterface $chillLogger, private readonly UserPasswordEncoderInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
public function __construct(private readonly LoggerInterface $chillLogger, private readonly \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder, private readonly RecoverPasswordHelper $recoverPasswordHelper, private readonly TokenManager $tokenManager, private readonly TranslatorInterface $translator, private readonly EventDispatcherInterface $eventDispatcher, private readonly ChillSecurity $security, private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
/**
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-changed", name="password_request_recover_changed")
*/
#[Route(path: '/public/{_locale}/password/request-changed', name: 'password_request_recover_changed')]
public function changeConfirmedAction()
{
return $this->render('@ChillMain/Password/recover_password_changed.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/recover", name="password_recover")
*/
#[Route(path: '/public/{_locale}/password/recover', name: 'password_recover')]
public function recoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
@ -96,7 +92,7 @@ final class PasswordController extends AbstractController
if ($form->isSubmitted() && $form->isValid()) {
$password = $form->get('new_password')->getData();
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
// logging for prod
$this
->chillLogger
@ -120,9 +116,11 @@ final class PasswordController extends AbstractController
/**
* @throws \Doctrine\ORM\NoResultException
* @throws \Doctrine\ORM\NonUniqueResultException
* @throws \Doctrine\ORM\NonUniqueResultException
*
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-recover", name="password_request_recover")
*/
#[Route(path: '/public/{_locale}/password/request-recover', name: 'password_request_recover')]
public function requestRecoverAction(Request $request): Response|\Symfony\Component\HttpFoundation\RedirectResponse
{
if (false === $this->isGranted(PasswordRecoverVoter::ASK_TOKEN)) {
@ -193,9 +191,8 @@ final class PasswordController extends AbstractController
/**
* @return Response
*
* @\Symfony\Component\Routing\Annotation\Route(path="/public/{_locale}/password/request-confirm", name="password_request_recover_confirm")
*/
#[Route(path: '/public/{_locale}/password/request-confirm', name: 'password_request_recover_confirm')]
public function requestRecoverConfirmAction()
{
return $this->render('@ChillMain/Password/request_recover_password_confirm.html.twig');
@ -203,9 +200,8 @@ final class PasswordController extends AbstractController
/**
* @return Response
*
* @Route("/{_locale}/my/password", name="change_my_password")
*/
#[Route(path: '/{_locale}/my/password', name: 'change_my_password')]
public function UserPasswordAction(Request $request)
{
if (!$this->security->isGranted('ROLE_USER')) {
@ -234,7 +230,7 @@ final class PasswordController extends AbstractController
]
);
$user->setPassword($this->passwordEncoder->encodePassword($user, $password));
$user->setPassword($this->passwordEncoder->hashPassword($user, $password));
$em = $this->managerRegistry->getManager();
$em->flush();

View File

@ -24,10 +24,9 @@ class PermissionApiController extends AbstractController
public function __construct(private readonly DenormalizerInterface $denormalizer, private readonly Security $security) {}
/**
* @Route("/api/1.0/main/permissions/info.json", methods={"POST"})
*
* @throws \Symfony\Component\Serializer\Exception\ExceptionInterface
*/
#[Route(path: '/api/1.0/main/permissions/info.json', methods: ['POST'])]
public function getPermissions(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -49,9 +49,7 @@ final class PermissionsGroupController extends AbstractController
private readonly RoleScopeRepository $roleScopeRepository,
) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope", name="admin_permissionsgroup_add_role_scope", methods={"PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/add_link_role_scope', name: 'admin_permissionsgroup_add_role_scope', methods: ['PUT'])]
public function addLinkRoleScopeAction(Request $request, int $id): Response
{
$permissionsGroup = $this->permissionsGroupRepository->find($id);
@ -129,9 +127,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Creates a new PermissionsGroup entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/create", name="admin_permissionsgroup_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/create', name: 'admin_permissionsgroup_create', methods: ['POST'])]
public function createAction(Request $request): Response
{
$permissionsGroup = new PermissionsGroup();
@ -153,9 +150,8 @@ final class PermissionsGroupController extends AbstractController
/**
* remove an association between permissionsGroup and roleScope.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}", name="admin_permissionsgroup_delete_role_scope", methods={"DELETE"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{pgid}/delete_link_role_scope/{rsid}', name: 'admin_permissionsgroup_delete_role_scope', methods: ['DELETE'])]
public function deleteLinkRoleScopeAction(int $pgid, int $rsid): Response
{
$permissionsGroup = $this->permissionsGroupRepository->find($pgid);
@ -211,9 +207,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Displays a form to edit an existing PermissionsGroup entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/edit", name="admin_permissionsgroup_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/edit', name: 'admin_permissionsgroup_edit')]
public function editAction(int $id): Response
{
$permissionsGroup = $this->permissionsGroupRepository->find($id);
@ -259,9 +254,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Lists all PermissionsGroup entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/", name="admin_permissionsgroup")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/', name: 'admin_permissionsgroup')]
public function indexAction(): Response
{
$entities = $this->permissionsGroupRepository->findAllOrderedAlphabetically();
@ -273,9 +267,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Displays a form to create a new PermissionsGroup entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/new", name="admin_permissionsgroup_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/new', name: 'admin_permissionsgroup_new')]
public function newAction(): Response
{
$permissionsGroup = new PermissionsGroup();
@ -289,9 +282,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Finds and displays a PermissionsGroup entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/show", name="admin_permissionsgroup_show")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/show', name: 'admin_permissionsgroup_show')]
public function showAction(int $id): Response
{
$permissionsGroup = $this->permissionsGroupRepository->find($id);
@ -342,9 +334,8 @@ final class PermissionsGroupController extends AbstractController
/**
* Edits an existing PermissionsGroup entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/permissionsgroup/{id}/update", name="admin_permissionsgroup_update", methods={"POST", "PUT"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/permissionsgroup/{id}/update', name: 'admin_permissionsgroup_update', methods: ['POST', 'PUT'])]
public function updateAction(Request $request, int $id): Response
{
$permissionsGroup = $this->permissionsGroupRepository

View File

@ -28,9 +28,7 @@ final class PostalCodeAPIController extends ApiController
{
public function __construct(private readonly CountryRepository $countryRepository, private readonly PostalCodeRepositoryInterface $postalCodeRepository, private readonly PaginatorFactory $paginatorFactory) {}
/**
* @Route("/api/1.0/main/postal-code/search.json")
*/
#[Route(path: '/api/1.0/main/postal-code/search.json')]
public function search(Request $request): JsonResponse
{
$this->denyAccessUnlessGranted('ROLE_USER');

View File

@ -35,12 +35,9 @@ class PostalCodeController extends AbstractController
}
/**
* @Route(
* "{_locale}/postalcode/search"
* )
*
* @return JsonResponse
*/
#[Route(path: '{_locale}/postalcode/search')]
public function searchAction(Request $request)
{
$pattern = $request->query->getAlnum('q', '');

View File

@ -36,9 +36,7 @@ class SavedExportController
{
public function __construct(private readonly \Twig\Environment $templating, private readonly EntityManagerInterface $entityManager, private readonly ExportManager $exportManager, private readonly FormFactoryInterface $formFactory, private readonly SavedExportRepositoryInterface $savedExportRepository, private readonly Security $security, private readonly SessionInterface $session, private readonly TranslatorInterface $translator, private readonly UrlGeneratorInterface $urlGenerator) {}
/**
* @Route("/{_locale}/exports/saved/{id}/delete", name="chill_main_export_saved_delete")
*/
#[Route(path: '/{_locale}/exports/saved/{id}/delete', name: 'chill_main_export_saved_delete')]
public function delete(SavedExport $savedExport, Request $request): Response
{
if (!$this->security->isGranted(SavedExportVoter::DELETE, $savedExport)) {
@ -71,9 +69,7 @@ class SavedExportController
);
}
/**
* @Route("/{_locale}/exports/saved/{id}/edit", name="chill_main_export_saved_edit")
*/
#[Route(path: '/{_locale}/exports/saved/{id}/edit', name: 'chill_main_export_saved_edit')]
public function edit(SavedExport $savedExport, Request $request): Response
{
if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) {
@ -104,9 +100,7 @@ class SavedExportController
);
}
/**
* @Route("/{_locale}/exports/saved/my", name="chill_main_export_saved_list_my")
*/
#[Route(path: '/{_locale}/exports/saved/my', name: 'chill_main_export_saved_list_my')]
public function list(): Response
{
$user = $this->security->getUser();

View File

@ -32,9 +32,8 @@ class ScopeController extends AbstractController
/**
* Creates a new Scope entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/create", name="admin_scope_create", methods={"POST"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/create', name: 'admin_scope_create', methods: ['POST'])]
public function createAction(Request $request)
{
$scope = new Scope();
@ -57,9 +56,8 @@ class ScopeController extends AbstractController
/**
* Displays a form to edit an existing Scope entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/{id}/edit", name="admin_scope_edit")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/{id}/edit', name: 'admin_scope_edit')]
public function editAction(Scope $scope, Request $request): Response
{
$editForm = $this->createEditForm($scope);
@ -79,9 +77,8 @@ class ScopeController extends AbstractController
/**
* Lists all Scope entities.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/", name="admin_scope")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/', name: 'admin_scope')]
public function indexAction()
{
$em = $this->managerRegistry->getManager();
@ -95,9 +92,8 @@ class ScopeController extends AbstractController
/**
* Displays a form to create a new Scope entity.
*
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/admin/scope/new", name="admin_scope_new")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/admin/scope/new', name: 'admin_scope_new')]
public function newAction()
{
$scope = new Scope();

View File

@ -34,9 +34,7 @@ class SearchController extends AbstractController
{
public function __construct(protected SearchProvider $searchProvider, protected TranslatorInterface $translator, protected PaginatorFactory $paginatorFactory, protected SearchApi $searchApi) {}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced/{name}", name="chill_main_advanced_search")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced/{name}', name: 'chill_main_advanced_search')]
public function advancedSearchAction(mixed $name, Request $request)
{
try {
@ -81,9 +79,7 @@ class SearchController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search/advanced", name="chill_main_advanced_search_list")
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search/advanced', name: 'chill_main_advanced_search_list')]
public function advancedSearchListAction(Request $request)
{
/** @var Chill\MainBundle\Search\SearchProvider $variable */
@ -100,9 +96,7 @@ class SearchController extends AbstractController
return $this->render('@ChillMain/Search/choose_list.html.twig');
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/{_locale}/search.{_format}", name="chill_main_search", requirements={"_format"="html|json"}, defaults={"_format"="html"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/{_locale}/search.{_format}', name: 'chill_main_search', requirements: ['_format' => 'html|json'], defaults: ['_format' => 'html'])]
public function searchAction(Request $request, mixed $_format)
{
$pattern = trim((string) $request->query->get('q', ''));
@ -192,9 +186,7 @@ class SearchController extends AbstractController
);
}
/**
* @\Symfony\Component\Routing\Annotation\Route(path="/api/1.0/search.{_format}", name="chill_main_search_global", requirements={"_format"="json"}, defaults={"_format"="json"})
*/
#[\Symfony\Component\Routing\Annotation\Route(path: '/api/1.0/search.{_format}', name: 'chill_main_search_global', requirements: ['_format' => 'json'], defaults: ['_format' => 'json'])]
public function searchApi(Request $request, mixed $_format): JsonResponse
{
// TODO this is an incomplete implementation

Some files were not shown because too many files have changed in this diff Show More