Fix use of Ordering constant in doctrine orm association

See https://github.com/doctrine/orm/issues/11313 for a follow-up
This commit is contained in:
Julien Fastré 2024-04-08 13:09:24 +02:00
parent e8c7623a1e
commit 19ffef156b
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
4 changed files with 12 additions and 4 deletions

View File

@ -48,3 +48,11 @@ parameters:
"""
count: 2
path: src/Bundle/ChillPersonBundle/Entity/Person.php
-
message: """
#^Fetching deprecated class constant DESC of class Doctrine\\\\Common\\\\Collections\\\\Criteria\\:
use Order\\:\\:Descending instead$#
"""
count: 1
path: src/Bundle/ChillPersonBundle/Entity/AccompanyingPeriod.php

View File

@ -105,7 +105,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
/**
* @var Collection<CalendarDoc>
*/
#[ORM\OneToMany(targetEntity: CalendarDoc::class, mappedBy: 'calendar', orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'calendar', targetEntity: CalendarDoc::class, orphanRemoval: true)]
private Collection $documents;
#[Serializer\Groups(['calendar:read', 'read', 'calendar:light', 'docgen:read'])]
@ -123,7 +123,7 @@ class Calendar implements TrackCreationInterface, TrackUpdateInterface, HasCente
* @var Collection&Selectable<int, Invite>
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: Invite::class, mappedBy: 'calendar', orphanRemoval: true, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\OneToMany(mappedBy: 'calendar', targetEntity: Invite::class, cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
#[ORM\JoinTable(name: 'chill_calendar.calendar_to_invites')]
private Collection&Selectable $invites;

View File

@ -493,7 +493,7 @@ class User implements UserInterface, \Stringable, PasswordAuthenticatedUserInter
$this->scopeHistories[] = $newScope;
$criteria = new Criteria();
$criteria->orderBy(['startDate' => \Doctrine\Common\Collections\Order::Ascending, 'id' => \Doctrine\Common\Collections\Order::Ascending]);
$criteria->orderBy(['startDate' => 'ASC', 'id' => 'ASC']);
/** @var \Iterator $scopes */
$scopes = $this->scopeHistories->matching($criteria)->getIterator();

View File

@ -157,7 +157,7 @@ class AccompanyingPeriod implements
*/
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => Order::Descending, 'id' => 'DESC'])]
#[ORM\OrderBy(['createdAt' => Criteria::DESC, 'id' => 'DESC'])]
private Collection $comments;
#[Groups(['read', 'write', 'docgen:read'])]