diff --git a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php index 21adbea5e..d7b089598 100644 --- a/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php +++ b/src/Bundle/ChillPersonBundle/Entity/Person/PersonResource.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\Embeddable\CommentEmbeddable; use Chill\MainBundle\Entity\User; use Chill\PersonBundle\Entity\Person; use Chill\ThirdPartyBundle\Entity\ThirdParty; +use DateTime; use DateTimeInterface; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\DiscriminatorMap; @@ -46,14 +47,14 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface private ?Person $personOwner = null; /** - * @ORM\ManyToOne(targetEntity=Person::class) + * @ORM\ManyToOne(targetEntity=Person::class, inversedBy="personResources") * @ORM\JoinColumn(nullable=true) * @Groups({"read"}) */ private ?Person $person = null; /** - * @ORM\ManyToOne(targetEntity=ThirdParty::class) + * @ORM\ManyToOne(targetEntity=ThirdParty::class, inversedBy="personResources") * @ORM\JoinColumn(nullable=true) * @Groups({"read"}) */ @@ -171,7 +172,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface { $this->freeText = $freeText; - if ('' !== $freeText) { + if ('' !== $freeText && $freeText !== null) { $this->setPerson(null); $this->setThirdParty(null); } @@ -179,7 +180,7 @@ class PersonResource implements TrackCreationInterface, TrackUpdateInterface return $this; } - public function setComment(CommentEmbeddable $comment): self + public function setComment(?CommentEmbeddable $comment): self { $this->comment = $comment;