<?phpnamespace App\Entity;use App\Entity\Traits\Identifiable;use App\Repository\LegalPersonRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: LegalPersonRepository::class)]class LegalPerson implements BenefactorPersonInterface, EmailableInterface{ use Identifiable; #[ORM\Column(length: 100, nullable: true)] private ?string $name = null; #[ORM\Column(length: 100, nullable: true)] private ?string $company = null; #[ORM\Column(length: 20, nullable: true)] private ?string $phone = null; #[ORM\Column(length: 200, nullable: true)] private ?string $email = null; #[ORM\Embedded(class: Address::class)] private $address; #[ORM\OneToMany(mappedBy: 'legalPerson', targetEntity: Donation::class)] private Collection $donations; #[ORM\ManyToOne(inversedBy: 'legalPersons')] #[ORM\JoinColumn(nullable: false)] private ?Family $family = null; #[ORM\Column(options: ['default' => false])] private ?bool $benefactor = false; #[ORM\ManyToOne(inversedBy: 'legalPersons')] private ?Person $relatedPerson = null; public function __construct() { $this->address = new Address(); $this->donations = new ArrayCollection(); } public function __toString(): string { return $this->getName(); } public function getName(): ?string { return $this->name; } public function setName(?string $name): self { $this->name = $name; return $this; } public function getCompany(): ?string { return $this->company; } public function setCompany(?string $company): self { $this->company = $company; return $this; } public function getPhone(): ?string { return $this->phone; } public function setPhone(?string $phone): self { $this->phone = $phone; return $this; } public function getEmail(): ?string { return $this->email; } public function getSimpleEmail(): ?string { return $this->getEmail(); } public function setEmail(?string $email): self { $this->email = $email; return $this; } public function getAddress(): Address { return $this->address; } public function setAddress(Address $address): self { $this->address = $address; return $this; } /** * @return Collection<int, Donation> */ public function getDonations(): Collection { return $this->donations; } public function addDonation(Donation $donation): self { if (!$this->donations->contains($donation)) { $this->donations->add($donation); $donation->setLegalPerson($this); } return $this; } public function removeDonation(Donation $donation): self { if ($this->donations->removeElement($donation)) { // set the owning side to null (unless already changed) if ($donation->getLegalPerson() === $this) { $donation->setLegalPerson(null); } } return $this; } public function getFamily(): ?Family { return $this->family; } public function setFamily(?Family $family): self { $this->family = $family; return $this; } public function isBenefactor(): ?bool { return $this->benefactor; } public function setBenefactor(bool $benefactor): self { $this->benefactor = $benefactor; return $this; } public function getRelatedPerson(): ?Person { return $this->relatedPerson; } public function setRelatedPerson(?Person $relatedPerson): self { $this->relatedPerson = $relatedPerson; return $this; }}