bug fixed in entity

This commit is contained in:
Julie Lenaerts 2022-01-20 17:13:28 +01:00
parent dcdee1d6e3
commit d63d9c2f4e

View File

@ -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;