|
|
@@ -12,265 +12,177 @@ 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.organization.getId() "},
|
|
|
- * "put"={"security"="is_granted('ROLE_ORGANIZATION') and object.getId() == user.organization.getId() "}
|
|
|
- * }
|
|
|
- * )
|
|
|
- * @ORM\Entity(repositoryClass=OrganizationRepository::class)
|
|
|
*/
|
|
|
+#[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\GeneratedValue
|
|
|
- * @ORM\Column(type="integer")
|
|
|
- */
|
|
|
- private $id;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=128)
|
|
|
- */
|
|
|
- private $name;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=128)
|
|
|
- */
|
|
|
- private $identifier;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\LegalEnum", "toArray"})
|
|
|
- */
|
|
|
- private $legalStatus;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\PrincipalTypeEnum", "toArray"})
|
|
|
- */
|
|
|
- private $principalType;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToOne(targetEntity=Settings::class, mappedBy="organization", cascade={"persist", "remove"})
|
|
|
- */
|
|
|
- private $settings;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToMany(targetEntity=NetworkOrganization::class, mappedBy="organization", orphanRemoval=true)
|
|
|
- */
|
|
|
- private $networkOrganizations;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToMany(targetEntity=NetworkOrganization::class, mappedBy="parent")
|
|
|
- */
|
|
|
- private $networkOrganizationChildren;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToOne(targetEntity=Parameters::class, cascade={"persist", "remove"})
|
|
|
- * @ORM\JoinColumn(nullable=false)
|
|
|
- */
|
|
|
- private $parameters;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- */
|
|
|
- private $description;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="date", nullable=true)
|
|
|
- */
|
|
|
- private $creationDate;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="date", nullable=true)
|
|
|
- */
|
|
|
- private $declarationDate;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=14, nullable=true)
|
|
|
- */
|
|
|
- private $siretNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=10, nullable=true)
|
|
|
- */
|
|
|
- private $waldecNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=5, nullable=true)
|
|
|
- */
|
|
|
- private $apeNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=50, nullable=true)
|
|
|
- */
|
|
|
- private $tvaNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=40, nullable=true)
|
|
|
- */
|
|
|
- private $otherType;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=80, nullable=true)
|
|
|
- */
|
|
|
- private $acronym;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- */
|
|
|
- private $facebook;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- */
|
|
|
- private $twitter;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- */
|
|
|
- private $instagram;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=35, nullable=true)
|
|
|
- */
|
|
|
- private $collectiveAgreement;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\OpcaEnum", "toArray"})
|
|
|
- */
|
|
|
- private $opca;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=35, nullable=true)
|
|
|
- */
|
|
|
- private $icomNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=35, nullable=true)
|
|
|
- */
|
|
|
- private $urssafNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=20, nullable=true)
|
|
|
- */
|
|
|
- private $youngApproval;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=20, nullable=true)
|
|
|
- */
|
|
|
- private $trainingApproval;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=50, nullable=true)
|
|
|
- */
|
|
|
- private $otherApproval;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=35, nullable=true)
|
|
|
- */
|
|
|
- private $prefectureName;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=20, nullable=true)
|
|
|
- */
|
|
|
- private $prefectureNumber;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\CategoryEnum", "toArray"})
|
|
|
- */
|
|
|
- private $category;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\SchoolCategoryEnum", "toArray"})
|
|
|
- */
|
|
|
- private $schoolCategory;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\TypeEstablishmentEnum", "toArray"})
|
|
|
- */
|
|
|
- private $typeEstablishment;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=255, nullable=true)
|
|
|
- * @Assert\Choice(callback={"\App\Enum\Organization\TypeEstablishmentDetailEnum", "toArray"})
|
|
|
- */
|
|
|
- private $typeEstablishmentDetail;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="float", nullable=true)
|
|
|
- */
|
|
|
- private $budget;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="boolean", nullable=true)
|
|
|
- */
|
|
|
- private $isPedagogicIsPrincipalActivity;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="float", nullable=true)
|
|
|
- */
|
|
|
- private $pedagogicBudget;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="boolean", nullable=true)
|
|
|
- */
|
|
|
- private $isPerformanceContractor;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="string", length=20, nullable=true)
|
|
|
- */
|
|
|
- private $ffecApproval;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="boolean")
|
|
|
- */
|
|
|
- private $portailVisibility;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="integer", nullable=true)
|
|
|
- */
|
|
|
- private $cmsId;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\Column(type="text", nullable=true)
|
|
|
- */
|
|
|
- private $otherPractice;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\ManyToMany(targetEntity=ContactPoint::class, mappedBy="organization")
|
|
|
- * @ApiSubresource()
|
|
|
- */
|
|
|
- private $contactPoints;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\ManyToMany(targetEntity=BankAccount::class, mappedBy="organization")
|
|
|
- * @ApiSubresource()
|
|
|
- */
|
|
|
- private $bankAccounts;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToMany(targetEntity=OrganizationAddressPostal::class, mappedBy="organization", orphanRemoval=true)
|
|
|
- * @ApiSubresource()
|
|
|
- */
|
|
|
- private $organizationAddressPostals;
|
|
|
-
|
|
|
- /**
|
|
|
- * @ORM\OneToMany(targetEntity=OrganizationLicence::class, mappedBy="organization", orphanRemoval=true)
|
|
|
- */
|
|
|
- private $organizationLicences;
|
|
|
-
|
|
|
- public function __construct()
|
|
|
+ #[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();
|
|
|
@@ -285,7 +197,7 @@ class Organization
|
|
|
return $this->id;
|
|
|
}
|
|
|
|
|
|
- public function getName(): ?string
|
|
|
+ public function getName(): string
|
|
|
{
|
|
|
return $this->name;
|
|
|
}
|
|
|
@@ -297,7 +209,7 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function getIdentifier(): ?string
|
|
|
+ public function getIdentifier(): string
|
|
|
{
|
|
|
return $this->identifier;
|
|
|
}
|
|
|
@@ -333,7 +245,7 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function getSettings(): ?Settings
|
|
|
+ public function getSettings(): Settings
|
|
|
{
|
|
|
return $this->settings;
|
|
|
}
|
|
|
@@ -350,9 +262,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|NetworkOrganization[]
|
|
|
- */
|
|
|
public function getNetworkOrganizations(): Collection
|
|
|
{
|
|
|
return $this->networkOrganizations;
|
|
|
@@ -380,9 +289,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|NetworkOrganization[]
|
|
|
- */
|
|
|
public function getNetworkOrganizationChildren(): Collection
|
|
|
{
|
|
|
return $this->networkOrganizationChildren;
|
|
|
@@ -410,7 +316,7 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function getParameters(): ?Parameters
|
|
|
+ public function getParameters(): Parameters
|
|
|
{
|
|
|
return $this->parameters;
|
|
|
}
|
|
|
@@ -782,7 +688,7 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- public function getPortailVisibility(): ?bool
|
|
|
+ public function getPortailVisibility(): bool
|
|
|
{
|
|
|
return $this->portailVisibility;
|
|
|
}
|
|
|
@@ -818,9 +724,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|ContactPoint[]
|
|
|
- */
|
|
|
public function getContactPoints(): Collection
|
|
|
{
|
|
|
return $this->contactPoints;
|
|
|
@@ -845,9 +748,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|BankAccount[]
|
|
|
- */
|
|
|
public function getBankAccounts(): Collection
|
|
|
{
|
|
|
return $this->bankAccounts;
|
|
|
@@ -872,9 +772,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|OrganizationAddressPostal[]
|
|
|
- */
|
|
|
public function getOrganizationAddressPostals(): Collection
|
|
|
{
|
|
|
return $this->organizationAddressPostals;
|
|
|
@@ -902,9 +799,6 @@ class Organization
|
|
|
return $this;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * @return Collection|OrganizationLicence[]
|
|
|
- */
|
|
|
public function getOrganizationLicences(): Collection
|
|
|
{
|
|
|
return $this->organizationLicences;
|