finalize normalization on ressources

This commit is contained in:
2022-03-21 17:33:01 +01:00
parent b4add2de95
commit 169d4dc41c
6 changed files with 40 additions and 22 deletions

View File

@@ -39,13 +39,13 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\Embedded(class="Chill\MainBundle\Entity\Embeddable\CommentEmbeddable", columnPrefix="comment_")
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private CommentEmbeddable $comment;
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private ?string $freeText = null;
@@ -53,24 +53,29 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"read", "docgen:read"})
*/
private ?int $id;
/**
* @ORM\ManyToOne(targetEntity=PersonResourceKind::class, inversedBy="personResources")
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private $kind;
private ?PersonResourceKind $kind = null;
/**
* The person which host the owner of this resource.
*
* @ORM\ManyToOne(targetEntity=Person::class, inversedBy="personResources")
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private ?Person $person = null;
/**
* The person linked with this resource.
*
* @ORM\ManyToOne(targetEntity=Person::class)
* @ORM\JoinColumn(nullable=false)
* @Groups({"read"})
@@ -80,7 +85,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
/**
* @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources")
* @ORM\JoinColumn(nullable=true)
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
private ?ThirdParty $thirdParty = null;
@@ -117,8 +122,13 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
return $this->person;
}
public function getPersonOwner(): ?Person
{
return $this->personOwner;
}
/**
* @Groups({"read"})
* @Groups({"read", "docgen:read"})
*/
public function getResourceKind(): string
{
@@ -137,12 +147,6 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface
return 'none';
}
public function getPersonOwner(): ?Person
{
return $this->personOwner;
}
public function getThirdParty(): ?ThirdParty
{
return $this->thirdParty;