| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Organization;
- use ApiPlatform\Core\Annotation\ApiResource;
- use ApiPlatform\Core\Annotation\ApiSubresource;
- use App\Entity\Core\BankAccount;
- use App\Entity\Core\ContactPoint;
- use App\Entity\Network\NetworkOrganization;
- use App\Repository\Organization\OrganizationRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use JetBrains\PhpStorm\Pure;
- use Symfony\Component\Validator\Constraints as Assert;
- /**
- * Structure, organisation
- */
- #[ApiResource(
- itemOperations: [
- 'get' => [
- 'security' => '(is_granted("ROLE_ORGANIZATION_VIEW") or is_granted("ROLE_ORGANIZATION")) and object.getId() == user.getOrganization().getId()'
- ],
- 'put' => [
- 'security' => 'is_granted("ROLE_ORGANIZATION") and object.getId() == user.getOrganization()s.getId()'
- ]
- ]
- )]
- #[ORM\Entity(repositoryClass: OrganizationRepository::class)]
- class Organization
- {
- #[ORM\Id]
- #[ORM\Column]
- #[ORM\GeneratedValue]
- private ?int $id = null;
- #[ORM\Column(length: 128)]
- public string $name;
- #[ORM\Column(length: 128)]
- private string $identifier;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\LegalEnum', 'toArray'], message: 'invalid-legal-status')]
- private ?string $legalStatus = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\PrincipalTypeEnum', 'toArray'], message: 'invalid-principal-type')]
- private ?string $principalType = null;
- #[ORM\OneToOne(mappedBy: 'organization', cascade: ['persist', 'remove'])]
- private Settings $settings;
- #[ORM\OneToMany(mappedBy: 'organization', targetEntity: NetworkOrganization::class, orphanRemoval: true)]
- private Collection $networkOrganizations;
- #[ORM\OneToMany(mappedBy: 'parent', targetEntity: NetworkOrganization::class, orphanRemoval: true)]
- private Collection $networkOrganizationChildren;
- #[ORM\OneToOne(cascade: ['persist', 'remove'])]
- #[ORM\JoinColumn(nullable: false)]
- private Parameters $parameters;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $description = null;
- #[ORM\Column(type: 'date', nullable: true)]
- private ?\DateTimeInterface $creationDate = null;
- #[ORM\Column(type: 'date', nullable: true)]
- private ?\DateTimeInterface $declarationDate = null;
- #[ORM\Column(length: 14, nullable: true)]
- private ?string $siretNumber = null;
- #[ORM\Column(length: 10, nullable: true)]
- private ?string $waldecNumber = null;
- #[ORM\Column(length: 5, nullable: true)]
- private ?string $apeNumber = null;
- #[ORM\Column(length: 50, nullable: true)]
- private ?string $tvaNumber = null;
- #[ORM\Column(length: 40, nullable: true)]
- private ?string $otherType = null;
- #[ORM\Column(length: 80, nullable: true)]
- private ?string $acronym = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $facebook = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $twitter = null;
- #[ORM\Column(length: 255, nullable: true)]
- private ?string $instagram = null;
- #[ORM\Column(length: 35, nullable: true)]
- private ?string $collectiveAgreement = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\OpcaEnum', 'toArray'], message: 'invalid-opca')]
- private ?string $opca = null;
- #[ORM\Column(length: 35, nullable: true)]
- private ?string $icomNumber = null;
- #[ORM\Column(length: 35, nullable: true)]
- private ?string $urssafNumber = null;
- #[ORM\Column(length: 20, nullable: true)]
- private ?string $youngApproval = null;
- #[ORM\Column(length: 20, nullable: true)]
- private ?string $trainingApproval = null;
- #[ORM\Column(length: 50, nullable: true)]
- private ?string $otherApproval = null;
- #[ORM\Column(length: 35, nullable: true)]
- private ?string $prefectureName = null;
- #[ORM\Column(length: 20, nullable: true)]
- private ?string $prefectureNumber = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\CategoryEnum', 'toArray'], message: 'invalid-category')]
- private ?string $category = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\SchoolCategoryEnum', 'toArray'], message: 'invalid-school-category')]
- private ?string $schoolCategory = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\TypeEstablishmentEnum', 'toArray'], message: 'invalid-type-establishment')]
- private ?string $typeEstablishment = null;
- #[ORM\Column(length: 255, nullable: true)]
- #[Assert\Choice(callback: ['\App\Enum\Organization\TypeEstablishmentDetailEnum', 'toArray'], message: 'invalid-type-establishment-detail')]
- private ?string $typeEstablishmentDetail = null;
- #[ORM\Column(nullable: true)]
- private ?float $budget = null;
- #[ORM\Column(nullable: true)]
- private ?bool $isPedagogicIsPrincipalActivity = null;
- #[ORM\Column(nullable: true)]
- private ?float $pedagogicBudget = null;
- #[ORM\Column(nullable: true)]
- private ?bool $isPerformanceContractor = null;
- #[ORM\Column(length:20, nullable: true)]
- private ?string $ffecApproval = null;
- #[ORM\Column]
- private bool $portailVisibility;
- #[ORM\Column(nullable: true)]
- private ?int $cmsId = null;
- #[ORM\Column(nullable: true)]
- private ?string $otherPractice = null;
- #[ORM\ManyToMany(targetEntity: ContactPoint::class, mappedBy: 'organization')]
- #[ApiSubresource]
- private Collection $contactPoints;
- #[ORM\ManyToMany(targetEntity: BankAccount::class, mappedBy: 'organization')]
- #[ApiSubresource]
- private Collection $bankAccounts;
- #[ORM\OneToMany( mappedBy: 'organization', targetEntity: OrganizationAddressPostal::class, orphanRemoval: true)]
- #[ApiSubresource]
- private Collection $organizationAddressPostals;
- #[ORM\OneToMany(mappedBy: 'organization', targetEntity: OrganizationLicence::class, orphanRemoval: true)]
- private Collection $organizationLicences;
- #[Pure] public function __construct()
- {
- $this->networkOrganizations = new ArrayCollection();
- $this->networkOrganizationChildren = new ArrayCollection();
- $this->contactPoints = new ArrayCollection();
- $this->bankAccounts = new ArrayCollection();
- $this->organizationAddressPostals = new ArrayCollection();
- $this->organizationLicences = new ArrayCollection();
- }
- public function getId(): ?int
- {
- return $this->id;
- }
- public function getName(): string
- {
- return $this->name;
- }
- public function setName(string $name): self
- {
- $this->name = $name;
- return $this;
- }
- public function getIdentifier(): string
- {
- return $this->identifier;
- }
- public function setIdentifier(string $identifier): self
- {
- $this->identifier = $identifier;
- return $this;
- }
- public function getLegalStatus(): ?string
- {
- return $this->legalStatus;
- }
- public function setLegalStatus(?string $legalStatus): self
- {
- $this->legalStatus = $legalStatus;
- return $this;
- }
- public function getPrincipalType(): ?string
- {
- return $this->principalType;
- }
- public function setPrincipalType(?string $principalType): self
- {
- $this->principalType = $principalType;
- return $this;
- }
- public function getSettings(): Settings
- {
- return $this->settings;
- }
- public function setSettings(Settings $settings): self
- {
- // set the owning side of the relation if necessary
- if ($settings->getOrganization() !== $this) {
- $settings->setOrganization($this);
- }
- $this->settings = $settings;
- return $this;
- }
- public function getNetworkOrganizations(): Collection
- {
- return $this->networkOrganizations;
- }
- public function addNetworkOrganization(NetworkOrganization $networkOrganization): self
- {
- if (!$this->networkOrganizations->contains($networkOrganization)) {
- $this->networkOrganizations[] = $networkOrganization;
- $networkOrganization->setOrganization($this);
- }
- return $this;
- }
- public function removeNetworkOrganization(NetworkOrganization $networkOrganization): self
- {
- if ($this->networkOrganizations->removeElement($networkOrganization)) {
- // set the owning side to null (unless already changed)
- if ($networkOrganization->getOrganization() === $this) {
- $networkOrganization->setOrganization(null);
- }
- }
- return $this;
- }
- public function getNetworkOrganizationChildren(): Collection
- {
- return $this->networkOrganizationChildren;
- }
- public function addNetworkOrganizationChild(NetworkOrganization $networkOrganizationChild): self
- {
- if (!$this->networkOrganizationChildren->contains($networkOrganizationChild)) {
- $this->networkOrganizationChildren[] = $networkOrganizationChild;
- $networkOrganizationChild->setParent($this);
- }
- return $this;
- }
- public function removeNetworkOrganizationChild(NetworkOrganization $networkOrganizationChild): self
- {
- if ($this->networkOrganizationChildren->removeElement($networkOrganizationChild)) {
- // set the owning side to null (unless already changed)
- if ($networkOrganizationChild->getParent() === $this) {
- $networkOrganizationChild->setParent(null);
- }
- }
- return $this;
- }
- public function getParameters(): Parameters
- {
- return $this->parameters;
- }
- public function setParameters(Parameters $parameters): self
- {
- $this->parameters = $parameters;
- return $this;
- }
- public function getDescription(): ?string
- {
- return $this->description;
- }
- public function setDescription(?string $description): self
- {
- $this->description = $description;
- return $this;
- }
- public function getCreationDate(): ?\DateTimeInterface
- {
- return $this->creationDate;
- }
- public function setCreationDate(?\DateTimeInterface $creationDate): self
- {
- $this->creationDate = $creationDate;
- return $this;
- }
- public function getDeclarationDate(): ?\DateTimeInterface
- {
- return $this->declarationDate;
- }
- public function setDeclarationDate(?\DateTimeInterface $declarationDate): self
- {
- $this->declarationDate = $declarationDate;
- return $this;
- }
- public function getSiretNumber(): ?string
- {
- return $this->siretNumber;
- }
- public function setSiretNumber(?string $siretNumber): self
- {
- $this->siretNumber = $siretNumber;
- return $this;
- }
- public function getWaldecNumber(): ?string
- {
- return $this->waldecNumber;
- }
- public function setWaldecNumber(?string $waldecNumber): self
- {
- $this->waldecNumber = $waldecNumber;
- return $this;
- }
- public function getApeNumber(): ?string
- {
- return $this->apeNumber;
- }
- public function setApeNumber(?string $apeNumber): self
- {
- $this->apeNumber = $apeNumber;
- return $this;
- }
- public function getTvaNumber(): ?string
- {
- return $this->tvaNumber;
- }
- public function setTvaNumber(?string $tvaNumber): self
- {
- $this->tvaNumber = $tvaNumber;
- return $this;
- }
- public function getOtherType(): ?string
- {
- return $this->otherType;
- }
- public function setOtherType(?string $otherType): self
- {
- $this->otherType = $otherType;
- return $this;
- }
- public function getAcronym(): ?string
- {
- return $this->acronym;
- }
- public function setAcronym(?string $acronym): self
- {
- $this->acronym = $acronym;
- return $this;
- }
- public function getFacebook(): ?string
- {
- return $this->facebook;
- }
- public function setFacebook(?string $facebook): self
- {
- $this->facebook = $facebook;
- return $this;
- }
- public function getTwitter(): ?string
- {
- return $this->twitter;
- }
- public function setTwitter(?string $twitter): self
- {
- $this->twitter = $twitter;
- return $this;
- }
- public function getInstagram(): ?string
- {
- return $this->instagram;
- }
- public function setInstagram(?string $instagram): self
- {
- $this->instagram = $instagram;
- return $this;
- }
- public function getCollectiveAgreement(): ?string
- {
- return $this->collectiveAgreement;
- }
- public function setCollectiveAgreement(?string $collectiveAgreement): self
- {
- $this->collectiveAgreement = $collectiveAgreement;
- return $this;
- }
- public function getOpca(): ?string
- {
- return $this->opca;
- }
- public function setOpca(?string $opca): self
- {
- $this->opca = $opca;
- return $this;
- }
- public function getIcomNumber(): ?string
- {
- return $this->icomNumber;
- }
- public function setIcomNumber(?string $icomNumber): self
- {
- $this->icomNumber = $icomNumber;
- return $this;
- }
- public function getUrssafNumber(): ?string
- {
- return $this->urssafNumber;
- }
- public function setUrssafNumber(?string $urssafNumber): self
- {
- $this->urssafNumber = $urssafNumber;
- return $this;
- }
- public function getYoungApproval(): ?string
- {
- return $this->youngApproval;
- }
- public function setYoungApproval(?string $youngApproval): self
- {
- $this->youngApproval = $youngApproval;
- return $this;
- }
- public function getTrainingApproval(): ?string
- {
- return $this->trainingApproval;
- }
- public function setTrainingApproval(?string $trainingApproval): self
- {
- $this->trainingApproval = $trainingApproval;
- return $this;
- }
- public function getOtherApproval(): ?string
- {
- return $this->otherApproval;
- }
- public function setOtherApproval(?string $otherApproval): self
- {
- $this->otherApproval = $otherApproval;
- return $this;
- }
- public function getPrefectureName(): ?string
- {
- return $this->prefectureName;
- }
- public function setPrefectureName(?string $prefectureName): self
- {
- $this->prefectureName = $prefectureName;
- return $this;
- }
- public function getPrefectureNumber(): ?string
- {
- return $this->prefectureNumber;
- }
- public function setPrefectureNumber(?string $prefectureNumber): self
- {
- $this->prefectureNumber = $prefectureNumber;
- return $this;
- }
- public function getCategory(): ?string
- {
- return $this->category;
- }
- public function setCategory(?string $category): self
- {
- $this->category = $category;
- return $this;
- }
- public function getSchoolCategory(): ?string
- {
- return $this->schoolCategory;
- }
- public function setSchoolCategory(?string $schoolCategory): self
- {
- $this->schoolCategory = $schoolCategory;
- return $this;
- }
- public function getTypeEstablishment(): ?string
- {
- return $this->typeEstablishment;
- }
- public function setTypeEstablishment(?string $typeEstablishment): self
- {
- $this->typeEstablishment = $typeEstablishment;
- return $this;
- }
- public function getTypeEstablishmentDetail(): ?string
- {
- return $this->typeEstablishmentDetail;
- }
- public function setTypeEstablishmentDetail(?string $typeEstablishmentDetail): self
- {
- $this->typeEstablishmentDetail = $typeEstablishmentDetail;
- return $this;
- }
- public function getBudget(): ?float
- {
- return $this->budget;
- }
- public function setBudget(?float $budget): self
- {
- $this->budget = $budget;
- return $this;
- }
- public function getIsPedagogicIsPrincipalActivity(): ?bool
- {
- return $this->isPedagogicIsPrincipalActivity;
- }
- public function setIsPedagogicIsPrincipalActivity(?bool $isPedagogicIsPrincipalActivity): self
- {
- $this->isPedagogicIsPrincipalActivity = $isPedagogicIsPrincipalActivity;
- return $this;
- }
- public function getPedagogicBudget(): ?float
- {
- return $this->pedagogicBudget;
- }
- public function setPedagogicBudget(?float $pedagogicBudget): self
- {
- $this->pedagogicBudget = $pedagogicBudget;
- return $this;
- }
- public function getIsPerformanceContractor(): ?bool
- {
- return $this->isPerformanceContractor;
- }
- public function setIsPerformanceContractor(?bool $isPerformanceContractor): self
- {
- $this->isPerformanceContractor = $isPerformanceContractor;
- return $this;
- }
- public function getFfecApproval(): ?string
- {
- return $this->ffecApproval;
- }
- public function setFfecApproval(?string $ffecApproval): self
- {
- $this->ffecApproval = $ffecApproval;
- return $this;
- }
- public function getPortailVisibility(): bool
- {
- return $this->portailVisibility;
- }
- public function setPortailVisibility(bool $portailVisibility): self
- {
- $this->portailVisibility = $portailVisibility;
- return $this;
- }
- public function getCmsId(): ?int
- {
- return $this->cmsId;
- }
- public function setCmsId(?int $cmsId): self
- {
- $this->cmsId = $cmsId;
- return $this;
- }
- public function getOtherPractice(): ?string
- {
- return $this->otherPractice;
- }
- public function setOtherPractice(?string $otherPractice): self
- {
- $this->otherPractice = $otherPractice;
- return $this;
- }
- public function getContactPoints(): Collection
- {
- return $this->contactPoints;
- }
- public function addContactPoint(ContactPoint $contactPoint): self
- {
- if (!$this->contactPoints->contains($contactPoint)) {
- $this->contactPoints[] = $contactPoint;
- $contactPoint->addOrganization($this);
- }
- return $this;
- }
- public function removeContactPoint(ContactPoint $contactPoint): self
- {
- if ($this->contactPoints->removeElement($contactPoint)) {
- $contactPoint->removeOrganization($this);
- }
- return $this;
- }
- public function getBankAccounts(): Collection
- {
- return $this->bankAccounts;
- }
- public function addBankAccount(BankAccount $bankAccount): self
- {
- if (!$this->bankAccounts->contains($bankAccount)) {
- $this->bankAccounts[] = $bankAccount;
- $bankAccount->addOrganization($this);
- }
- return $this;
- }
- public function removeBankAccount(BankAccount $bankAccount): self
- {
- if ($this->bankAccounts->removeElement($bankAccount)) {
- $bankAccount->removeOrganization($this);
- }
- return $this;
- }
- public function getOrganizationAddressPostals(): Collection
- {
- return $this->organizationAddressPostals;
- }
- public function addOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
- {
- if (!$this->organizationAddressPostals->contains($organizationAddressPostal)) {
- $this->organizationAddressPostals[] = $organizationAddressPostal;
- $organizationAddressPostal->setOrganization($this);
- }
- return $this;
- }
- public function removeOrganizationAddressPostal(OrganizationAddressPostal $organizationAddressPostal): self
- {
- if ($this->organizationAddressPostals->removeElement($organizationAddressPostal)) {
- // set the owning side to null (unless already changed)
- if ($organizationAddressPostal->getOrganization() === $this) {
- $organizationAddressPostal->setOrganization(null);
- }
- }
- return $this;
- }
- public function getOrganizationLicences(): Collection
- {
- return $this->organizationLicences;
- }
- public function addOrganizationLicence(OrganizationLicence $organizationLicence): self
- {
- if (!$this->organizationLicences->contains($organizationLicence)) {
- $this->organizationLicences[] = $organizationLicence;
- $organizationLicence->setOrganization($this);
- }
- return $this;
- }
- public function removeOrganizationLicence(OrganizationLicence $organizationLicence): self
- {
- if ($this->organizationLicences->removeElement($organizationLicence)) {
- // set the owning side to null (unless already changed)
- if ($organizationLicence->getOrganization() === $this) {
- $organizationLicence->setOrganization(null);
- }
- }
- return $this;
- }
- }
|