Generate a context for docgen, on accompanying period

This commit is contained in:
2021-11-30 23:23:02 +01:00
parent 3404d3669c
commit de4e83b3fb
19 changed files with 433 additions and 128 deletions

View File

@@ -117,11 +117,11 @@ class AccompanyingPeriod implements
* @var DateTime
*
* @ORM\Column(type="date", nullable=true)
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
* @Assert\GreaterThan(propertyPath="openingDate", groups={AccompanyingPeriod::STEP_CLOSED})
*/
private $closingDate;
private ?DateTime $closingDate = null;
/**
* @var AccompanyingPeriod\ClosingMotive
@@ -132,7 +132,7 @@ class AccompanyingPeriod implements
* @Groups({"read", "write"})
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CLOSED})
*/
private $closingMotive;
private ?ClosingMotive $closingMotive = null;
/**
* @var Collection
@@ -144,33 +144,34 @@ class AccompanyingPeriod implements
* )
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_DRAFT})
*/
private $comments;
private Collection $comments;
/**
* @var bool
* @ORM\Column(type="boolean", options={"default": false})
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
*/
private $confidential = false;
private bool $confidential = false;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
* @Groups({"docgen:read"})
*/
private DateTimeInterface $createdAt;
private ?DateTimeInterface $createdAt = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private $createdBy;
private ?User $createdBy = null;
/**
* @var bool
* @ORM\Column(type="boolean", options={"default": false})
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
*/
private $emergency = false;
private bool $emergency = false;
/**
* @var int
@@ -178,9 +179,9 @@ class AccompanyingPeriod implements
* @ORM\Id
* @ORM\Column(name="id", type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private $id;
private ?int $id = null;
/**
* @ORM\ManyToOne(
@@ -202,9 +203,9 @@ class AccompanyingPeriod implements
* @var DateTime
*
* @ORM\Column(type="date")
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
*/
private $openingDate;
private ?DateTime $openingDate = null;
/**
* @ORM\ManyToOne(targetEntity=Origin::class)
@@ -212,7 +213,7 @@ class AccompanyingPeriod implements
* @Groups({"read", "write"})
* @Assert\NotBlank(groups={AccompanyingPeriod::STEP_CONFIRMED})
*/
private $origin;
private ?Origin $origin = null;
/**
* @var Collection
@@ -220,10 +221,10 @@ class AccompanyingPeriod implements
* @ORM\OneToMany(targetEntity=AccompanyingPeriodParticipation::class,
* mappedBy="accompanyingPeriod", orphanRemoval=true,
* cascade={"persist", "refresh", "remove", "merge", "detach"})
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
* @ParticipationOverlap(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED})
*/
private $participations;
private Collection $participations;
/**
* @ORM\ManyToOne(
@@ -239,26 +240,26 @@ class AccompanyingPeriod implements
* @ORM\Column(type="text")
* @Groups({"read", "write"})
*/
private $remark = '';
private string $remark = '';
/**
* @var bool
* @ORM\Column(type="boolean", options={"default": false})
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
*/
private $requestorAnonymous = false;
private bool $requestorAnonymous = false;
/**
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="accompanyingPeriodRequested")
* @ORM\JoinColumn(nullable=true)
*/
private $requestorPerson;
private ?Person $requestorPerson = null;
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class)
* @ORM\JoinColumn(nullable=true)
*/
private $requestorThirdParty;
private ?ThirdParty $requestorThirdParty = null;
/**
* @var Collection
@@ -272,7 +273,7 @@ class AccompanyingPeriod implements
* @Groups({"read"})
* @ResourceDuplicateCheck(groups={AccompanyingPeriod::STEP_DRAFT, AccompanyingPeriod::STEP_CONFIRMED, "Default", "default"})
*/
private $resources;
private Collection $resources;
/**
* @var Collection
@@ -288,7 +289,7 @@ class AccompanyingPeriod implements
* @Groups({"read"})
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must be associated to at least one scope")
*/
private $scopes;
private Collection $scopes;
/**
* @ORM\ManyToMany(
@@ -297,7 +298,7 @@ class AccompanyingPeriod implements
* @ORM\JoinTable(
* name="chill_person_accompanying_period_social_issues"
* )
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
* @Assert\Count(min=1, groups={AccompanyingPeriod::STEP_CONFIRMED}, minMessage="A course must contains at least one social issue")
*/
private Collection $socialIssues;
@@ -307,26 +308,26 @@ class AccompanyingPeriod implements
* @ORM\Column(type="string", length=32, nullable=true)
* @Groups({"read"})
*/
private $step = self::STEP_DRAFT;
private string $step = self::STEP_DRAFT;
/**
* @ORM\Column(type="datetime", nullable=true, options={"default": NULL})
*/
private DateTimeInterface $updatedAt;
private ?DateTimeInterface $updatedAt = null;
/**
* @ORM\ManyToOne(
* targetEntity=User::class
* )
*/
private User $updatedBy;
private ?User $updatedBy = null;
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=true)
* @Groups({"read", "write"})
* @Groups({"read", "write", "docgen:read"})
*/
private $user;
private ?User $user = null;
/**
* @ORM\OneToMany(
@@ -577,6 +578,11 @@ class AccompanyingPeriod implements
});
}
public function getCreatedAt(): ?DateTime
{
return $this->createdAt;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
@@ -605,7 +611,7 @@ class AccompanyingPeriod implements
*
* @return int
*/
public function getId()
public function getId(): ?int
{
return $this->id;
}
@@ -631,7 +637,7 @@ class AccompanyingPeriod implements
public function getLocation(?DateTimeImmutable $at = null): ?Address
{
if ($this->getPersonLocation() instanceof Person) {
return $this->getPersonLocation()->getCurrentHouseholdAddress($at);
return $this->getPersonLocation()->getCurrentPersonAddress();
}
return $this->getAddressLocation();
@@ -660,7 +666,7 @@ class AccompanyingPeriod implements
*
* @return DateTime
*/
public function getOpeningDate()
public function getOpeningDate(): ?\DateTime
{
return $this->openingDate;
}