src/Entity/Institution.php line 33
<?phpdeclare(strict_types=1);namespace App\Entity;use ApiPlatform\Core\Annotation\ApiResource;use App\Entity\Mapped\NamedEntity;use App\Repository\InstitutionRepository;use App\Validator\Constraint as CustomValidator;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: InstitutionRepository::class)]#[ORM\Table(name: 'institution')]#[ApiResource(collectionOperations: [],itemOperations: ['get'])]#[CustomValidator\OIBFormat(message: 'institution.oib.format',groups: ['action'])]#[CustomValidator\OIBInstitutionUnique(message: 'institution.oib.unique',groups: ['action'])]class Institution extends NamedEntity implements DocumentOwnerInterface{#[ORM\Column(name: 'label',type: 'string',length: 191,nullable: true)]#[Assert\NotBlank(groups: ['action'])]#[Assert\Length(max: 3,groups: ['action'])]private ?string $label = null;#[ORM\Column(name: 'color',type: 'string',length: 191,nullable: true)]#[Assert\NotBlank(groups: ['action'])]#[Assert\Length(max: 100,groups: ['action'])]private ?string $color = null;#[ORM\Column(name: 'oib',type: 'string',length: 191,nullable: true)]#[Assert\NotBlank(groups: ['action'])]private ?string $oib = null;#[ORM\Column(name: 'address',type: 'string',length: 191,nullable: true)]private ?string $address = null;#[ORM\Column(name: 'place',type: 'string',length: 191,nullable: true)]private ?string $place = null;#[ORM\Column(name: 'country',type: 'string',length: 191,nullable: true)]private ?string $country = null;#[ORM\Column(name: 'contact_phone',type: 'string',length: 191,nullable: true)]private ?string $contactPhone = null;#[ORM\Column(name: 'contact_email',type: 'string',length: 191,nullable: true)]private ?string $contactEmail = null;#[ORM\Column(name: 'web_page',type: 'string',length: 191,nullable: true)]private ?string $webPage = null;#[ORM\Column(name: 'additional_data',type: 'text',nullable: true)]private ?string $additionalData = null;#[ORM\Column(name: 'is_pdv',type: 'boolean',nullable: true)]private ?bool $isPdv = false;#[ORM\ManyToOne(targetEntity: LegalEntity::class)]#[ORM\JoinColumn(name: 'legal_entity')]#[Assert\NotBlank(groups: ['action'])]#[Assert\NotBlank(groups: ['action'])]private ?LegalEntity $legalEntity = null;#[ORM\OneToMany(mappedBy: 'institution',targetEntity: InstitutionContactPerson::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]#[Assert\Valid(groups: ['action'])]private iterable $contactPerson;#[ORM\OneToMany(mappedBy: 'institution',targetEntity: InstitutionResponsiblePerson::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]#[Assert\Valid(groups: ['action'])]private iterable $responsiblePerson;#[ORM\OneToMany(mappedBy: 'institution',targetEntity: InstitutionDocument::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]#[Assert\Valid(groups: ['action'])]private iterable $document;#[ORM\OneToMany(mappedBy: 'institution',targetEntity: UserInstitution::class,cascade: ['persist'],fetch: 'EXTRA_LAZY',orphanRemoval: true)]private iterable $userInstitution;public function __construct(){$this->contactPerson = new ArrayCollection();$this->responsiblePerson = new ArrayCollection();$this->document = new ArrayCollection();$this->userInstitution = new ArrayCollection();}public function getLabel(): ?string{return $this->label;}public function setLabel(?string $label): self{$this->label = $label;return $this;}public function getColor(): ?string{return $this->color;}public function setColor(?string $color): self{$this->color = $color;return $this;}public function getOib(): ?string{return $this->oib;}public function setOib(?string $oib): self{$this->oib = $oib;return $this;}public function getAddress(): ?string{return $this->address;}public function setAddress(?string $address): self{$this->address = $address;return $this;}public function getPlace(): ?string{return $this->place;}public function setPlace(?string $place): self{$this->place = $place;return $this;}public function getCountry(): ?string{return $this->country;}public function setCountry(?string $country): self{$this->country = $country;return $this;}public function getContactPhone(): ?string{return $this->contactPhone;}public function setContactPhone(?string $contactPhone): self{$this->contactPhone = $contactPhone;return $this;}public function getContactEmail(): ?string{return $this->contactEmail;}public function setContactEmail(?string $contactEmail): self{$this->contactEmail = $contactEmail;return $this;}public function getWebPage(): ?string{return $this->webPage;}public function setWebPage(?string $webPage): self{$this->webPage = $webPage;return $this;}public function getAdditionalData(): ?string{return $this->additionalData;}public function setAdditionalData(?string $additionalData): self{$this->additionalData = $additionalData;return $this;}public function getIsPdv(): ?bool{return $this->isPdv;}public function setIsPdv(?bool $isPdv): self{$this->isPdv = $isPdv;return $this;}public function getUserInstitution(): iterable{return $this->userInstitution;}public function getLegalEntity(): ?LegalEntity{return $this->legalEntity;}public function setLegalEntity(?LegalEntity $legalEntity): self{$this->legalEntity = $legalEntity;return $this;}public function getContactPerson(): iterable{return $this->contactPerson;}public function addContactPerson(InstitutionContactPerson $contactPerson): void{if ($this->contactPerson->contains($contactPerson)) {return;}$this->contactPerson[] = $contactPerson;$contactPerson->setInstitution($this);}public function removeContactPerson(InstitutionContactPerson $contactPerson): void{if (!$this->contactPerson->contains($contactPerson)) {return;}$this->contactPerson->removeElement($contactPerson);$contactPerson->setInstitution(null);}public function getResponsiblePerson(): iterable{return $this->responsiblePerson;}public function addResponsiblePerson(InstitutionResponsiblePerson $responsiblePerson): void{if ($this->responsiblePerson->contains($responsiblePerson)) {return;}$this->responsiblePerson[] = $responsiblePerson;$responsiblePerson->setInstitution($this);}public function removeResponsiblePerson(InstitutionResponsiblePerson $responsiblePerson): void{if (!$this->responsiblePerson->contains($responsiblePerson)) {return;}$this->responsiblePerson->removeElement($responsiblePerson);$responsiblePerson->setInstitution(null);}public function getDocument(): iterable{return $this->document;}public function addDocument(DocumentInterface $document): void{if ($this->document->contains($document)) {return;}$this->document[] = $document;$document->setInstitution($this);}public function removeDocument(DocumentInterface $document): void{if (!$this->document->contains($document)) {return;}$this->document->removeElement($document);$document->setInstitution(null);}}