Merge branch 'upgrade-sf5' into signature-app-master

This commit is contained in:
2024-08-28 13:23:12 +02:00
295 changed files with 14804 additions and 852 deletions

View File

@@ -23,7 +23,16 @@ use Symfony\Component\HttpFoundation\Response;
*/
class EntityPersonCRUDController extends CRUDController
{
public function __construct(private readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
public function __construct(protected readonly \Doctrine\Persistence\ManagerRegistry $managerRegistry) {}
protected function generateTemplateParameter(string $action, mixed $entity, Request $request, array $defaultTemplateParameters = [])
{
$templateParameters = parent::generateTemplateParameter($action, $entity, $request, $defaultTemplateParameters);
$templateParameters['person'] = $this->getPerson($request);
return $templateParameters;
}
/**
* Override the base method to add a filtering step to a person.
@@ -66,25 +75,6 @@ class EntityPersonCRUDController extends CRUDController
return $qb;
}
/**
* @throws \Exception
*/
protected function generateTemplateParameter(string $action, $entity, Request $request, array $defaultTemplateParameters = []): array
{
$person = $this->getPerson($request);
if (null === $person) {
throw new \Exception('the `person_id` parameter is not set in the query. You should set it or override the current method to allow another behaviour: '.__METHOD__);
}
return parent::generateTemplateParameter(
$action,
$entity,
$request,
\array_merge(['person' => $person], $defaultTemplateParameters)
);
}
/**
* Extract the person from the request.
*

View File

@@ -109,11 +109,10 @@ final class AccompanyingCourseController extends \Symfony\Bundle\FrameworkBundle
'accompanying_period_id' => $accompanyingCourse->getId(),
'person_id' => $person_id,
]))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
if (Request::METHOD_DELETE === $request->getMethod()) {
if (Request::METHOD_POST === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {

View File

@@ -80,10 +80,10 @@ final class AccompanyingCourseWorkController extends AbstractController
$form = $this->createDeleteForm($work->getId());
if (Request::METHOD_DELETE === $request->getMethod()) {
if (Request::METHOD_POST === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$this->chillLogger->notice('An accompanying period work has been removed', [
'by_user' => $this->getUser()->getUsername(),
'work_id' => $work->getId(),
@@ -179,7 +179,6 @@ final class AccompanyingCourseWorkController extends AbstractController
return $this->createFormBuilder()
->setAction($this->generateUrl('chill_person_accompanying_period_work_delete', $params))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
}

View File

@@ -63,11 +63,10 @@ class HouseholdCompositionController extends AbstractController
'composition_id' => $composition_id,
'household_id' => $household_id,
]))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
if (Request::METHOD_DELETE === $request->getMethod()) {
if (Request::METHOD_POST === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {

View File

@@ -44,14 +44,13 @@ final class PersonResourceController extends AbstractController
'resource_id' => $resource_id,
'person_id' => $person_id,
]))
->setMethod('DELETE')
->add('submit', SubmitType::class, ['label' => 'Delete'])
->getForm();
if (Request::METHOD_DELETE === $request->getMethod()) {
if (Request::METHOD_POST === $request->getMethod()) {
$form->handleRequest($request);
if ($form->isValid()) {
if ($form->isSubmitted() && $form->isValid()) {
$this->em->remove($resource);
$this->em->flush();

View File

@@ -135,14 +135,14 @@ class AccompanyingPeriod implements
private ?Location $administrativeLocation = null;
/**
* @var Collection&Selectable<int, Calendar>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\CalendarBundle\Entity\Calendar>&Selectable
*/
#[ORM\OneToMany(targetEntity: Calendar::class, mappedBy: 'accompanyingPeriod')]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Calendar::class)]
private Collection&Selectable $calendars;
#[Groups(['read', 'write', 'docgen:read'])]
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_CLOSED])]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', groups: [AccompanyingPeriod::STEP_CLOSED], message: 'The closing date must be later than the date of creation')]
#[Assert\GreaterThanOrEqual(propertyPath: 'openingDate', message: 'The closing date must be later than the date of creation', groups: [AccompanyingPeriod::STEP_CLOSED])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_MUTABLE, nullable: true)]
private ?\DateTime $closingDate = null;
@@ -153,10 +153,10 @@ class AccompanyingPeriod implements
private ?ClosingMotive $closingMotive = null;
/**
* @var Collection<Comment>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\PersonBundle\Entity\AccompanyingPeriod\Comment>
*/
#[Assert\NotBlank(groups: [AccompanyingPeriod::STEP_DRAFT])]
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: Comment::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => Criteria::DESC, 'id' => 'DESC'])]
private Collection $comments;
@@ -194,9 +194,9 @@ class AccompanyingPeriod implements
private ?UserJob $job = null;
/**
* @var Collection<AccompanyingPeriodLocationHistory>
* @var Collection<int, AccompanyingPeriodLocationHistory>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodLocationHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'period', targetEntity: AccompanyingPeriodLocationHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $locationHistories;
#[Groups(['read', 'write', 'docgen:read'])]
@@ -212,10 +212,10 @@ class AccompanyingPeriod implements
private ?Origin $origin = null;
/**
* @var Collection<AccompanyingPeriodParticipation>
* @var Collection<int, AccompanyingPeriodParticipation>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'])]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: AccompanyingPeriodParticipation::class, cascade: ['persist', 'refresh', 'remove', 'merge', 'detach'], orphanRemoval: true)]
#[ParticipationOverlap(groups: [AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED])]
private Collection $participations;
@@ -246,7 +246,7 @@ class AccompanyingPeriod implements
private ?ThirdParty $requestorThirdParty = null;
/**
* @var Collection<resource>
* @var Collection<int, AccompanyingPeriod\Resource>
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriod\Resource::class, mappedBy: 'accompanyingPeriod', cascade: ['persist', 'remove'], orphanRemoval: true)]
@@ -254,7 +254,7 @@ class AccompanyingPeriod implements
private Collection $resources;
/**
* @var Collection<Scope>
* @var Collection<int, Scope>
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must be associated to at least one scope')]
@@ -263,7 +263,7 @@ class AccompanyingPeriod implements
private Collection $scopes;
/**
* @var Collection<SocialIssue>
* @var Collection<int, SocialIssue>
*/
#[Groups(['read', 'docgen:read'])]
#[Assert\Count(min: 1, groups: [AccompanyingPeriod::STEP_CONFIRMED], minMessage: 'A course must contains at least one social issue')]
@@ -279,9 +279,9 @@ class AccompanyingPeriod implements
private ?string $step = self::STEP_DRAFT;
/**
* @var Collection<AccompanyingPeriodStepHistory>
* @var Collection<int, AccompanyingPeriodStepHistory>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodStepHistory::class, mappedBy: 'period', cascade: ['persist', 'remove'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'period', targetEntity: AccompanyingPeriodStepHistory::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $stepHistories;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true, options: ['default' => null])]
@@ -296,7 +296,7 @@ class AccompanyingPeriod implements
private ?User $user = null;
/**
* @var Collection<UserHistory>
* @var Collection<int, UserHistory>
*/
#[ORM\OneToMany(targetEntity: UserHistory::class, mappedBy: 'accompanyingPeriod', orphanRemoval: true, cascade: ['persist', 'remove'])]
private Collection $userHistories;
@@ -311,10 +311,10 @@ class AccompanyingPeriod implements
private ?User $userPrevious = null;
/**
* @var Collection<AccompanyingPeriodWork>
* @var Collection<int, AccompanyingPeriodWork>
*/
#[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'accompanyingPeriod')]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriod', targetEntity: AccompanyingPeriodWork::class)]
private Collection $works;
/**
@@ -427,7 +427,7 @@ class AccompanyingPeriod implements
return $this;
}
public function addResource(Resource $resource): self
public function addResource(AccompanyingPeriod\Resource $resource): self
{
$resource->setAccompanyingPeriod($this);
$this->resources[] = $resource;
@@ -592,7 +592,7 @@ class AccompanyingPeriod implements
}
/**
* @return ReadableCollection<(int|string), Comment>
* @return ReadableCollection<int, Comment>
*/
#[Groups(['read'])]
public function getComments(): ReadableCollection
@@ -801,7 +801,7 @@ class AccompanyingPeriod implements
/**
* Get a list of all persons which are participating to this course.
*
* @psalm-return Collection<(int|string), Person|null>
* @psalm-return Collection<int, Person|null>
*/
public function getPersons(): Collection
{
@@ -897,6 +897,9 @@ class AccompanyingPeriod implements
return $this->requestorThirdParty;
}
/**
* @return Collection<int, AccompanyingPeriod\Resource>
*/
public function getResources(): Collection
{
return $this->resources;

View File

@@ -40,13 +40,13 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private ?AccompanyingPeriod $accompanyingPeriod = null;
/**
* @var Collection<AccompanyingPeriodWorkEvaluation>
* @var Collection<int, AccompanyingPeriodWorkEvaluation>
*
* @internal the serialization for write evaluations is handled in `accompanyingperiodworkdenormalizer`
* @internal the serialization for context docgen:read is handled in `accompanyingperiodworknormalizer`
*/
#[Serializer\Groups(['read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluation::class, mappedBy: 'accompanyingPeriodWork', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriodWork', targetEntity: AccompanyingPeriodWorkEvaluation::class, cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['startDate' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $accompanyingPeriodWorkEvaluations;
@@ -73,10 +73,10 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private ?\DateTimeImmutable $endDate = null;
/**
* @var Collection<AccompanyingPeriodWorkGoal>
* @var Collection<int, AccompanyingPeriodWorkGoal>
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkGoal::class, mappedBy: 'accompanyingPeriodWork', cascade: ['persist'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriodWork', targetEntity: AccompanyingPeriodWorkGoal::class, cascade: ['persist'], orphanRemoval: true)]
private Collection $goals;
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
@@ -94,7 +94,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private string $note = '';
/**
* @var Collection<Person>
* @var Collection<int, Person>
*/
#[Serializer\Groups(['read', 'docgen:read', 'read:accompanyingPeriodWork:light', 'accompanying_period_work:edit', 'accompanying_period_work:create'])]
#[ORM\ManyToMany(targetEntity: Person::class)]
@@ -112,7 +112,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private Collection $referrersHistory;
/**
* @var Collection<Result>
* @var Collection<int, \Chill\PersonBundle\Entity\SocialWork\Result>
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorks')]
@@ -129,7 +129,7 @@ class AccompanyingPeriodWork implements AccompanyingPeriodLinkedWithSocialIssues
private ?\DateTimeImmutable $startDate = null;
/**
* @var Collection<ThirdParty>
* @var Collection<int, ThirdParty>
*/
#[Serializer\Groups(['read', 'docgen:read', 'accompanying_period_work:edit'])]
#[ORM\ManyToMany(targetEntity: ThirdParty::class)]

View File

@@ -47,10 +47,10 @@ class AccompanyingPeriodWorkEvaluation implements TrackCreationInterface, TrackU
*
* @see{Chill\PersonBundle\Serializer\Normalizer\AccompanyingPeriodWorkEvaluationDenormalizer}
*
* @var Collection<AccompanyingPeriodWorkEvaluationDocument>
* @var Collection<int, AccompanyingPeriodWorkEvaluationDocument>
*/
#[Serializer\Groups(['read'])]
#[ORM\OneToMany(targetEntity: AccompanyingPeriodWorkEvaluationDocument::class, mappedBy: 'accompanyingPeriodWorkEvaluation', cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OneToMany(mappedBy: 'accompanyingPeriodWorkEvaluation', targetEntity: AccompanyingPeriodWorkEvaluationDocument::class, cascade: ['remove', 'persist'], orphanRemoval: true)]
#[ORM\OrderBy(['createdAt' => \Doctrine\Common\Collections\Criteria::DESC, 'id' => 'DESC'])]
private Collection $documents;

View File

@@ -41,7 +41,7 @@ class AccompanyingPeriodWorkGoal
private string $note = '';
/**
* @var Collection<Result>
* @var Collection<int, Result>
*/
#[Serializer\Groups(['accompanying_period_work:edit', 'read', 'docgen:read'])]
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'accompanyingPeriodWorkGoals')]

View File

@@ -29,9 +29,9 @@ class ClosingMotive
/**
* Child Accompanying periods.
*
* @var Collection<ClosingMotive>
* @var Collection<int, ClosingMotive>
*/
#[ORM\OneToMany(targetEntity: ClosingMotive::class, mappedBy: 'parent')]
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: ClosingMotive::class)]
private Collection $children;
#[Serializer\Groups(['docgen:read'])]
@@ -182,11 +182,9 @@ class ClosingMotive
/**
* Set name.
*
* @param array $name
*
* @return ClosingMotive
*/
public function setName($name)
public function setName(array $name)
{
$this->name = $name;

View File

@@ -21,6 +21,7 @@ use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\ReadableCollection;
use Doctrine\Common\Collections\Selectable;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Validator\Constraints as Assert;
@@ -35,7 +36,7 @@ class Household implements HasCentersInterface
/**
* Addresses.
*
* @var Collection<Address>
* @var Collection<int, \Chill\MainBundle\Entity\Address>
*/
#[Serializer\Groups(['write'])]
#[ORM\ManyToMany(targetEntity: Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
@@ -47,33 +48,33 @@ class Household implements HasCentersInterface
private CommentEmbeddable $commentMembers;
/**
* @var Collection&Selectable<int, HouseholdComposition>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\PersonBundle\Entity\Household\HouseholdComposition>&Selectable
*/
#[Assert\Valid(traverse: true, groups: ['household_composition'])]
#[ORM\OneToMany(targetEntity: HouseholdComposition::class, mappedBy: 'household', orphanRemoval: true, cascade: ['persist'])]
#[Assert\Valid(groups: ['household_composition'], traverse: true)]
#[ORM\OneToMany(mappedBy: 'household', targetEntity: HouseholdComposition::class, cascade: ['persist'], orphanRemoval: true)]
#[ORM\OrderBy(['startDate' => Criteria::DESC])]
private Collection&Selectable $compositions;
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
/**
* @var Collection<HouseholdMember>
* @var Collection<int, HouseholdMember>
*/
#[Serializer\Groups(['read', 'docgen:read'])]
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'household')]
#[ORM\OneToMany(mappedBy: 'household', targetEntity: HouseholdMember::class)]
private Collection $members;
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN, name: 'waiting_for_birth', options: ['default' => false])]
#[ORM\Column(name: 'waiting_for_birth', type: Types::BOOLEAN, options: ['default' => false])]
#[Assert\Type('boolean', groups: ['household_metadata'])]
private bool $waitingForBirth = false;
#[Serializer\Groups(['docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
#[ORM\Column(type: Types::DATE_IMMUTABLE, name: 'waiting_for_birth_date', nullable: true, options: ['default' => null])]
#[Assert\Expression('this.getWaitingForBirth() == false or value != null', message: 'The waiting for birth date must be set', groups: ['household_metadata'])]
private ?\DateTimeImmutable $waitingForBirthDate = null;

View File

@@ -39,6 +39,7 @@ use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Selectable;
use Doctrine\ORM\Mapping as ORM;
use libphonenumber\PhoneNumber;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
@@ -86,7 +87,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* The person's accompanying periods (when the person was accompanied by the center).
*
* @var Collection<AccompanyingPeriodParticipation>
* @var Collection<int, \Chill\PersonBundle\Entity\AccompanyingPeriodParticipation>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriodParticipation::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\OrderBy(['startDate' => Criteria::DESC])]
@@ -95,7 +96,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* The accompanying period requested by the Person.
*
* @var Collection<AccompanyingPeriod>
* @var Collection<int, \Chill\PersonBundle\Entity\AccompanyingPeriod>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'requestorPerson')]
private Collection $accompanyingPeriodRequested;
@@ -103,7 +104,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Addresses.
*
* @var Collection<Address>
* @var Collection<int, \Chill\MainBundle\Entity\Address>
*/
#[ORM\ManyToMany(targetEntity: Address::class, cascade: ['persist', 'remove', 'merge', 'detach'])]
#[ORM\JoinTable(name: 'chill_person_persons_to_addresses')]
@@ -111,7 +112,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private Collection $addresses;
/**
* @var Collection<PersonAltName>
* @var Collection<int, \Chill\PersonBundle\Entity\PersonAltName>
*/
#[ORM\OneToMany(targetEntity: PersonAltName::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $altNames;
@@ -124,13 +125,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private ?\DateTime $birthdate = null;
/**
* @var Collection<Charge>
* @var Collection<int, \Chill\BudgetBundle\Entity\Charge>
*/
#[ORM\OneToMany(targetEntity: Charge::class, mappedBy: 'person')]
private Collection $budgetCharges;
/**
* @var Collection<resource>
* @var Collection<int, \Chill\BudgetBundle\Entity\Resource>
*/
#[ORM\OneToMany(targetEntity: Resource::class, mappedBy: 'person')]
private Collection $budgetResources;
@@ -149,14 +150,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
#[ORM\ManyToOne(targetEntity: Center::class)]
private ?Center $center = null;
#[ORM\OneToOne(targetEntity: PersonCenterCurrent::class, mappedBy: 'person')]
#[ORM\OneToOne(mappedBy: 'person', targetEntity: PersonCenterCurrent::class)]
private ?PersonCenterCurrent $centerCurrent = null;
/**
* @var Collection<PersonCenterHistory>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\PersonBundle\Entity\Person\PersonCenterHistory>&Selectable
*/
#[ORM\OneToMany(targetEntity: PersonCenterHistory::class, mappedBy: 'person', cascade: ['persist', 'remove'])]
private Collection $centerHistory;
#[ORM\OneToMany(mappedBy: 'person', targetEntity: PersonCenterHistory::class, cascade: ['persist', 'remove'])]
private Collection&Selectable $centerHistory;
/**
* Array where customfield's data are stored.
@@ -256,13 +257,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
/**
* Read-only field, computed by the database.
*
* @var Collection<PersonHouseholdAddress>
* @var Collection<int, \Chill\PersonBundle\Entity\Household\PersonHouseholdAddress>
*/
#[ORM\OneToMany(targetEntity: PersonHouseholdAddress::class, mappedBy: 'person')]
private Collection $householdAddresses;
/**
* @var Collection<HouseholdMember>
* @var Collection<int, \Chill\PersonBundle\Entity\Household\HouseholdMember>
*/
#[ORM\OneToMany(targetEntity: HouseholdMember::class, mappedBy: 'person')]
private Collection $householdParticipations;
@@ -330,14 +331,14 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
private ?int $numberOfChildren = null;
/**
* @var Collection<PersonPhone>
* @var Collection<int, \Chill\PersonBundle\Entity\PersonPhone>
*/
#[Assert\Valid(traverse: true)]
#[ORM\OneToMany(targetEntity: PersonPhone::class, mappedBy: 'person', cascade: ['persist', 'remove', 'merge', 'detach'], orphanRemoval: true)]
private Collection $otherPhoneNumbers;
/**
* @var Collection<AccompanyingPeriod>
* @var Collection<int, \Chill\PersonBundle\Entity\AccompanyingPeriod>
*/
#[ORM\OneToMany(targetEntity: AccompanyingPeriod::class, mappedBy: 'personLocation')]
private Collection $periodLocatedOn;
@@ -361,7 +362,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::BOOLEAN)]
private bool $proxyAccompanyingPeriodOpenState = false; // TO-DELETE ?
/**
* @var Collection<PersonResource>
* @var Collection<int, \Chill\PersonBundle\Entity\Person\PersonResource>
*/
#[ORM\OneToMany(targetEntity: PersonResource::class, mappedBy: 'personOwner')]
private Collection $resources;
@@ -1409,10 +1410,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this;
}
/**
* @param \DateTime $birthdate
*/
public function setBirthdate($birthdate): self
public function setBirthdate(?\DateTime $birthdate): self
{
$this->birthdate = $birthdate;
@@ -1443,7 +1441,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this;
}
public function setCenterHistory(Collection $centerHistory): Person
public function setCenterHistory(Collection&Selectable $centerHistory): Person
{
$this->centerHistory = $centerHistory;
@@ -1527,7 +1525,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
return $this;
}
public function setFullnameCanonical($fullnameCanonical): self
public function setFullnameCanonical(?string $fullnameCanonical): self
{
$this->fullnameCanonical = $fullnameCanonical;
@@ -1636,7 +1634,7 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
}
/**
* @param (\Doctrine\Common\Collections\Collection<int, Language>) $spokenLanguages
* @param (Collection<int, Language>) $spokenLanguages
*/
public function setSpokenLanguages(Collection $spokenLanguages): self
{

View File

@@ -0,0 +1,198 @@
<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\MappedSuperclass]
class AbstractPersonResource implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
#[Groups(['read', 'docgen:read'])]
private CommentEmbeddable $comment;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
#[Groups(['read', 'docgen:read'])]
private ?string $freeText = null;
#[ORM\ManyToOne(targetEntity: PersonResourceKind::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
#[Groups(['read', 'docgen:read'])]
private ?PersonResourceKind $kind = null;
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
#[Groups(['read', 'docgen:read'])]
private ?Person $person = null;
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'resources')]
#[ORM\JoinColumn(nullable: false)]
#[Groups(['read'])]
private ?Person $personOwner = null;
#[ORM\ManyToOne(targetEntity: ThirdParty::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
#[Groups(['read', 'docgen:read'])]
private ?ThirdParty $thirdParty = null;
public function __construct()
{
$this->comment = new CommentEmbeddable();
}
public function getComment(): CommentEmbeddable
{
return $this->comment;
}
public function getFreeText(): ?string
{
return $this->freeText;
}
public function getKind(): ?PersonResourceKind
{
return $this->kind;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getPersonOwner(): ?Person
{
return $this->personOwner;
}
/**
* @Groups({"read", "docgen:read"})
*/
public function getResourceKind(): string
{
if ($this->getPerson() instanceof Person) {
return 'person';
}
if ($this->getThirdParty() instanceof ThirdParty) {
return 'thirdparty';
}
if (null !== $this->getFreeText()) {
return 'freetext';
}
return 'none';
}
public function getThirdParty(): ?ThirdParty
{
return $this->thirdParty;
}
public function setComment(?CommentEmbeddable $comment): self
{
if (null === $comment) {
$this->comment->setComment('');
return $this;
}
$this->comment = $comment;
return $this;
}
public function setFreeText(?string $freeText): self
{
$this->freeText = $freeText;
if ('' !== $freeText && null !== $freeText) {
$this->setPerson(null);
$this->setThirdParty(null);
}
if ('' === $freeText) {
$this->freeText = null;
}
return $this;
}
public function setKind(?PersonResourceKind $kind): self
{
$this->kind = $kind;
return $this;
}
public function setPerson(?Person $person): self
{
$this->person = $person;
if (null !== $person) {
$this->setFreeText('');
$this->setThirdParty(null);
}
return $this;
}
public function setPersonOwner(?Person $personOwner): self
{
$this->personOwner = $personOwner;
return $this;
}
public function setThirdParty(?ThirdParty $thirdParty): self
{
$this->thirdParty = $thirdParty;
if (null !== $thirdParty) {
$this->setFreeText('');
$this->setPerson(null);
}
return $this;
}
/**
* @Assert\Callback
*/
public function validate(ExecutionContextInterface $context, mixed $payload): void
{
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {
$context->buildViolation('You must associate at least one entity')
->addViolation();
}
if (null !== $this->person && $this->person === $this->personOwner) {
$context->buildViolation('You cannot associate a resource with the same person')
->addViolation();
}
}
}

View File

@@ -12,206 +12,24 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Entity\Person;
use Chill\MainBundle\Doctrine\Model\TrackCreationInterface;
use Chill\MainBundle\Doctrine\Model\TrackCreationTrait;
use Chill\MainBundle\Doctrine\Model\TrackUpdateInterface;
use Chill\MainBundle\Doctrine\Model\TrackUpdateTrait;
use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable;
use Chill\PersonBundle\Entity\Person;
use Chill\ThirdPartyBundle\Entity\ThirdParty;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation as Serializer;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Context\ExecutionContextInterface;
#[Serializer\DiscriminatorMap(typeProperty: 'type', mapping: ['personResource' => PersonResource::class])]
#[ORM\Entity]
#[ORM\Table(name: 'chill_person_resource')]
class PersonResource implements TrackCreationInterface, TrackUpdateInterface
class PersonResource extends AbstractPersonResource implements TrackCreationInterface, TrackUpdateInterface
{
use TrackCreationTrait;
use TrackUpdateTrait;
#[Groups(['read', 'docgen:read'])]
#[ORM\Embedded(class: CommentEmbeddable::class, columnPrefix: 'comment_')]
private CommentEmbeddable $comment;
#[Groups(['read', 'docgen:read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::TEXT, nullable: true)]
private ?string $freeText = null;
#[Groups(['read', 'docgen:read'])]
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
private ?int $id = null;
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: PersonResourceKind::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
private ?PersonResourceKind $kind = null;
/**
* The person which host the owner of this resource.
*/
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: Person::class)]
#[ORM\JoinColumn(nullable: true)]
private ?Person $person = null;
/**
* The person linked with this resource.
*/
#[Groups(['read'])]
#[ORM\ManyToOne(targetEntity: Person::class, inversedBy: 'resources')]
#[ORM\JoinColumn(nullable: false)]
private ?Person $personOwner = null;
#[Groups(['read', 'docgen:read'])]
#[ORM\ManyToOne(targetEntity: ThirdParty::class, inversedBy: 'personResources')]
#[ORM\JoinColumn(nullable: true)]
private ?ThirdParty $thirdParty = null;
public function __construct()
{
$this->comment = new CommentEmbeddable();
}
public function getComment(): CommentEmbeddable
{
return $this->comment;
}
public function getFreeText(): ?string
{
return $this->freeText;
}
/**
* GETTERS.
*/
public function getId(): ?int
{
return $this->id;
}
public function getKind(): ?PersonResourceKind
{
return $this->kind;
}
public function getPerson(): ?Person
{
return $this->person;
}
public function getPersonOwner(): ?Person
{
return $this->personOwner;
}
#[Groups(['read', 'docgen:read'])]
public function getResourceKind(): string
{
if ($this->getPerson() instanceof Person) {
return 'person';
}
if ($this->getThirdParty() instanceof ThirdParty) {
return 'thirdparty';
}
if (null !== $this->getFreeText()) {
return 'freetext';
}
return 'none';
}
public function getThirdParty(): ?ThirdParty
{
return $this->thirdParty;
}
public function setComment(?CommentEmbeddable $comment): self
{
if (null === $comment) {
$this->comment->setComment('');
return $this;
}
$this->comment = $comment;
return $this;
}
public function setFreeText(?string $freeText): self
{
$this->freeText = $freeText;
if ('' !== $freeText && null !== $freeText) {
$this->setPerson(null);
$this->setThirdParty(null);
}
if ('' === $freeText) {
$this->freeText = null;
}
return $this;
}
public function setKind(?PersonResourceKind $kind): self
{
$this->kind = $kind;
return $this;
}
public function setPerson(?Person $person): self
{
$this->person = $person;
if (null !== $person) {
$this->setFreeText('');
$this->setThirdParty(null);
}
return $this;
}
public function setPersonOwner(?Person $personOwner): self
{
$this->personOwner = $personOwner;
return $this;
}
public function setThirdParty(?ThirdParty $thirdParty): self
{
$this->thirdParty = $thirdParty;
if (null !== $thirdParty) {
$this->setFreeText('');
$this->setPerson(null);
}
return $this;
}
#[Assert\Callback]
public function validate(ExecutionContextInterface $context, mixed $payload)
{
if (null === $this->person && null === $this->thirdParty && (null === $this->freeText || '' === $this->freeText)) {
$context->buildViolation('You must associate at least one entity')
->addViolation();
}
if (null !== $this->person && $this->person === $this->personOwner) {
$context->buildViolation('You cannot associate a resource with the same person')
->addViolation();
}
}
}

View File

@@ -76,7 +76,7 @@ class PersonNotDuplicate
$this->date = $date;
}
public function setId($id)
public function setId(?int $id)
{
$this->id = $id;
}

View File

@@ -39,7 +39,7 @@ class Evaluation
private ?\DateInterval $notificationDelay = null;
/**
* @var Collection<SocialAction>
* @var \Doctrine\Common\Collections\Collection<int, \Chill\PersonBundle\Entity\SocialWork\SocialAction>
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'evaluations')]
private Collection $socialActions;

View File

@@ -31,14 +31,14 @@ class Goal
private ?int $id = null;
/**
* @var Collection<Result>
* @var Collection<int, Result>
*/
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'goals')]
#[ORM\JoinTable(name: 'chill_person_social_work_goal_result')]
private Collection $results;
/**
* @var Collection<SocialAction>
* @var Collection<int, SocialAction>
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'goals')]
private Collection $socialActions;

View File

@@ -24,13 +24,13 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class Result
{
/**
* @var Collection<AccompanyingPeriodWorkGoal>
* @var Collection<int, AccompanyingPeriodWorkGoal>
*/
#[ORM\ManyToMany(targetEntity: AccompanyingPeriodWorkGoal::class, mappedBy: 'results')]
private Collection $accompanyingPeriodWorkGoals;
/**
* @var Collection<AccompanyingPeriodWork>
* @var Collection<int, AccompanyingPeriodWork>
*/
#[ORM\ManyToMany(targetEntity: AccompanyingPeriodWork::class, mappedBy: 'results')]
private Collection $accompanyingPeriodWorks;
@@ -39,7 +39,7 @@ class Result
private ?\DateTime $desactivationDate = null;
/**
* @var Collection<Goal>
* @var Collection<int, Goal>
*/
#[ORM\ManyToMany(targetEntity: Goal::class, mappedBy: 'results')]
private Collection $goals;
@@ -51,7 +51,7 @@ class Result
private ?int $id = null;
/**
* @var Collection<SocialAction>
* @var Collection<int, SocialAction>
*/
#[ORM\ManyToMany(targetEntity: SocialAction::class, mappedBy: 'results')]
private Collection $socialActions;

View File

@@ -23,9 +23,9 @@ use Symfony\Component\Serializer\Annotation as Serializer;
class SocialAction
{
/**
* @var Collection<SocialAction>
* @var Collection<int, SocialAction>
*/
#[ORM\OneToMany(targetEntity: SocialAction::class, mappedBy: 'parent')]
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: SocialAction::class)]
private Collection $children;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATEINTERVAL, nullable: true)]
@@ -35,14 +35,14 @@ class SocialAction
private ?\DateTimeInterface $desactivationDate = null;
/**
* @var Collection<Evaluation>
* @var Collection<int, Evaluation>
*/
#[ORM\ManyToMany(targetEntity: Evaluation::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_work_evaluation_action')]
private Collection $evaluations;
/**
* @var Collection<Goal>
* @var Collection<int, Goal>
*/
#[ORM\ManyToMany(targetEntity: Goal::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_action_goal')]
@@ -63,7 +63,7 @@ class SocialAction
private ?SocialAction $parent = null;
/**
* @var Collection<Result>
* @var Collection<int, Result>
*/
#[ORM\ManyToMany(targetEntity: Result::class, inversedBy: 'socialActions')]
#[ORM\JoinTable(name: 'chill_person_social_action_result')]

View File

@@ -13,6 +13,7 @@ namespace Chill\PersonBundle\Entity\SocialWork;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Annotation\Groups;
@@ -23,33 +24,33 @@ use Symfony\Component\Serializer\Annotation\Groups;
class SocialIssue
{
/**
* @var Collection<SocialIssue>
* @var Collection<int, SocialIssue>
*/
#[ORM\OneToMany(targetEntity: SocialIssue::class, mappedBy: 'parent')]
#[ORM\OneToMany(mappedBy: 'parent', targetEntity: SocialIssue::class)]
private Collection $children;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::DATETIME_MUTABLE, nullable: true)]
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $desactivationDate = null;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::INTEGER)]
#[ORM\Column(type: Types::INTEGER)]
private ?int $id = null;
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::FLOAT, name: 'ordering', options: ['default' => '0.0'])]
#[ORM\Column(name: 'ordering', type: Types::FLOAT, options: ['default' => '0.0'])]
private float $ordering = 0.0;
#[ORM\ManyToOne(targetEntity: SocialIssue::class, inversedBy: 'children')]
private ?SocialIssue $parent = null;
/**
* @var Collection<SocialAction>
* @var Collection<int, SocialAction>
*/
#[ORM\OneToMany(targetEntity: SocialAction::class, mappedBy: 'issue')]
#[ORM\OneToMany(mappedBy: 'issue', targetEntity: SocialAction::class)]
private Collection $socialActions;
#[Groups(['read'])]
#[ORM\Column(type: \Doctrine\DBAL\Types\Types::JSON)]
#[ORM\Column(type: Types::JSON)]
private array $title = [];
public function __construct()

View File

@@ -20,13 +20,13 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Symfony\Component\Form\FormBuilderInterface;
final class OriginAggregator implements AggregatorInterface
final readonly class OriginAggregator implements AggregatorInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(
EntityManagerInterface $em,
private readonly TranslatableStringHelper $translatableStringHelper
private TranslatableStringHelper $translatableStringHelper
) {
$this->repository = $em->getRepository(Origin::class);
}

View File

@@ -23,10 +23,8 @@ use Chill\PersonBundle\Entity\Person;
use Chill\PersonBundle\Export\Declarations;
use Chill\PersonBundle\Export\Helper\ListPersonHelper;
use Chill\PersonBundle\Security\Authorization\PersonVoter;
use DateTimeImmutable;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Query;
use PhpOffice\PhpSpreadsheet\Shared\Date;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use Symfony\Component\Form\FormBuilderInterface;
@@ -41,7 +39,7 @@ class ListPerson implements ListInterface, GroupedExportInterface
public function __construct(
private readonly CustomFieldProvider $customFieldProvider,
private readonly ListPersonHelper $listPersonHelper,
private readonly EntityManagerInterface $entityManager,
protected readonly EntityManagerInterface $entityManager,
private readonly TranslatableStringHelper $translatableStringHelper,
ParameterBagInterface $parameterBag,
) {

View File

@@ -21,9 +21,9 @@ use Doctrine\ORM\EntityRepository;
* @method AccompanyingPeriodWorkGoal[] findAll()
* @method AccompanyingPeriodWorkGoal[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
final class AccompanyingPeriodWorkGoalRepository
final readonly class AccompanyingPeriodWorkGoalRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Comment;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class CommentRepository
final readonly class CommentRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Origin;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class OriginRepository
final readonly class OriginRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod\Resource;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class ResourceRepository
final readonly class ResourceRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\AccompanyingPeriodParticipation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class AccompanyingPeriodParticipationRepository
final readonly class AccompanyingPeriodParticipationRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class AccompanyingPeriodRepository implements ObjectRepository
final readonly class AccompanyingPeriodRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdComposition;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
final readonly class HouseholdCompositionRepository implements HouseholdCompositionRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdCompositionType;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
final readonly class HouseholdCompositionTypeRepository implements HouseholdCompositionTypeRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\Household\HouseholdMember;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class HouseholdMembersRepository
final readonly class HouseholdMembersRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -18,7 +18,7 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\ResultSetMappingBuilder;
use Doctrine\Persistence\ObjectRepository;
final class HouseholdRepository implements ObjectRepository
final readonly class HouseholdRepository implements ObjectRepository
{
private const SQL_BY_ACCOMPANYING_PERIOD_PARTICIPATION = <<<'SQL'
WITH participations AS (
@@ -40,9 +40,9 @@ final class HouseholdRepository implements ObjectRepository
SELECT {select} FROM households {limits}
SQL;
private readonly EntityManagerInterface $em;
private EntityManagerInterface $em;
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -16,9 +16,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class PersonHouseholdAddressRepository implements ObjectRepository
final readonly class PersonHouseholdAddressRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $em)
{

View File

@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
use Doctrine\Persistence\ObjectRepository;
final class PositionRepository implements ObjectRepository
final readonly class PositionRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\PersonAltName;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class PersonAltNameRepository
final readonly class PersonAltNameRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -16,9 +16,9 @@ use Chill\PersonBundle\Entity\PersonNotDuplicate;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class PersonNotDuplicateRepository
final readonly class PersonNotDuplicateRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class PersonResourceRepository implements ObjectRepository
final readonly class PersonResourceRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -15,9 +15,9 @@ use Chill\PersonBundle\Entity\SocialWork\Evaluation;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\EntityRepository;
final class EvaluationRepository implements EvaluationRepositoryInterface
final readonly class EvaluationRepository implements EvaluationRepositoryInterface
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -18,9 +18,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class GoalRepository implements ObjectRepository
final readonly class GoalRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -19,9 +19,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class ResultRepository implements ObjectRepository
final readonly class ResultRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class SocialActionRepository implements ObjectRepository
final readonly class SocialActionRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -17,9 +17,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ObjectRepository;
final class SocialIssueRepository implements ObjectRepository
final readonly class SocialIssueRepository implements ObjectRepository
{
private readonly EntityRepository $repository;
private EntityRepository $repository;
public function __construct(EntityManagerInterface $entityManager)
{

View File

@@ -2,10 +2,10 @@ import { createApp } from 'vue'
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { appMessages } from './js/i18n'
import { initPromise } from './store'
import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
import App from './App.vue';
import Banner from './components/Banner.vue';
import ToastPlugin from "vue-toast-notification";
const root = window.vueRootComponent;
@@ -22,7 +22,7 @@ if (root === 'app') {
})
.use(store)
.use(i18n)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 5000,
@@ -46,7 +46,7 @@ if (root === 'banner') {
})
.use(store)
.use(i18n)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 5000,

View File

@@ -3,7 +3,7 @@ import {_createI18n} from 'ChillMainAssets/vuejs/_js/i18n';
import {store} from './store';
import {personMessages} from 'ChillPersonAssets/vuejs/_js/i18n'
import App from './App.vue';
import VueToast from "vue-toast-notification";
import ToastPlugin from "vue-toast-notification";
const i18n = _createI18n(personMessages);
@@ -12,7 +12,7 @@ const app = createApp({
})
.use(store)
.use(i18n)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 10000,

View File

@@ -2,9 +2,9 @@ import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
import { store } from './store';
import { personMessages } from 'ChillPersonAssets/vuejs/_js/i18n';
import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
import App from './App.vue';
import ToastPlugin from "vue-toast-notification";
const i18n = _createI18n(personMessages);
@@ -12,7 +12,7 @@ const app = createApp({
template: `<app></app>`,
})
.use(store)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 10000,

View File

@@ -2,8 +2,8 @@ import { createApp } from 'vue';
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n';
import { appMessages } from './js/i18n';
import { store } from './store';
import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
import ToastPlugin from 'vue-toast-notification';
import App from './App.vue';
@@ -14,7 +14,7 @@ const app = createApp({
})
.use(store)
.use(i18n)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 5000,

View File

@@ -3,10 +3,9 @@ import { store } from "./store.js"
import { _createI18n } from 'ChillMainAssets/vuejs/_js/i18n'
import { visMessages } from './i18n'
import App from './App.vue'
import VueToast from 'vue-toast-notification';
import 'vue-toast-notification/dist/theme-sugar.css';
import './vis-network';
import ToastPlugin from "vue-toast-notification";
const i18n = _createI18n(visMessages)
const container = document.getElementById('relationship-graph')
@@ -27,7 +26,7 @@ const app = createApp({
})
.use(store)
.use(i18n)
.use(VueToast, {
.use(ToastPlugin, {
position: "bottom-right",
type: "error",
duration: 5000,

View File

@@ -47,25 +47,25 @@ use Symfony\Contracts\Translation\TranslatorInterface;
/**
* @see PersonContextTest
*/
final class PersonContext implements PersonContextInterface
final readonly class PersonContext implements PersonContextInterface
{
private readonly bool $showScopes;
private bool $showScopes;
public function __construct(
private readonly AuthorizationHelperInterface $authorizationHelper,
private readonly BaseContextData $baseContextData,
private readonly CenterResolverManagerInterface $centerResolverManager,
private readonly DocumentCategoryRepository $documentCategoryRepository,
private readonly EntityManagerInterface $em,
private readonly NormalizerInterface $normalizer,
private AuthorizationHelperInterface $authorizationHelper,
private BaseContextData $baseContextData,
private CenterResolverManagerInterface $centerResolverManager,
private DocumentCategoryRepository $documentCategoryRepository,
private EntityManagerInterface $em,
private NormalizerInterface $normalizer,
ParameterBagInterface $parameterBag,
private readonly ScopeRepositoryInterface $scopeRepository,
private readonly Security $security,
private readonly TranslatorInterface $translator,
private readonly TranslatableStringHelperInterface $translatableStringHelper,
private readonly ThirdPartyRender $thirdPartyRender,
private readonly ThirdPartyRepository $thirdPartyRepository,
private readonly ResidentialAddressRepository $residentialAddressRepository
private ScopeRepositoryInterface $scopeRepository,
private Security $security,
private TranslatorInterface $translator,
private TranslatableStringHelperInterface $translatableStringHelper,
private ThirdPartyRender $thirdPartyRender,
private ThirdPartyRepository $thirdPartyRepository,
private ResidentialAddressRepository $residentialAddressRepository
) {
$this->showScopes = $parameterBag->get('chill_main')['acl']['form_show_scopes'];
}

View File

@@ -11,8 +11,10 @@ declare(strict_types=1);
namespace Chill\PersonBundle\Validator\Constraints\Person;
use Symfony\Component\Validator\Constraint;
#[\Attribute(\Attribute::TARGET_CLASS)]
class PersonHasCenter extends \Symfony\Component\Validator\Constraint
class PersonHasCenter extends Constraint
{
public string $message = 'A center is required';