| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196 |
- <?php
- declare(strict_types=1);
- namespace App\Entity\Product;
- use ApiPlatform\Metadata\ApiResource;
- use App\Entity\Billing\AccessIntangible;
- use App\Entity\Core\Tagg;
- // use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
- use App\Entity\Education\EducationCurriculum;
- use App\Entity\Education\EducationCurriculumPack;
- use App\Entity\Organization\Organization;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @todo : A la suite de la migration, il faut supprimer le nom de la table pour avoir une table Intangible, et supprimer l'attribut discr.
- * @todo : migration table tag_product
- * Classe ... qui ...
- */
- #[ApiResource(operations: [])]
- // #[Auditable]
- #[ORM\Entity]
- #[ORM\Table(name: 'Product')]
- class Intangible extends AbstractProduct
- {
- #[ORM\Column(length: 255, nullable: false)]
- protected string $discr = 'intangible';
- #[ORM\ManyToOne(inversedBy: 'intangibles')]
- protected Organization $organization;
- #[ORM\ManyToMany(targetEntity: EducationCurriculum::class)]
- protected Collection $educationCurriculums;
- #[ORM\OneToMany(mappedBy: 'intangible', targetEntity: AccessIntangible::class, cascade: ['persist'], orphanRemoval: true)]
- protected Collection $accessIntangibles;
- #[ORM\ManyToMany(targetEntity: Tagg::class, inversedBy: 'intangibles', cascade: ['persist'])]
- #[ORM\JoinTable(name: 'tag_product')]
- #[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id')]
- #[ORM\InverseJoinColumn(name: 'tag_id', referencedColumnName: 'id')]
- protected Collection $tags;
- #[ORM\ManyToMany(targetEntity: EducationCurriculumPack::class, inversedBy: 'intangibles', cascade: [], orphanRemoval: false)]
- protected Collection $educationCurriculumPacks;
- #[ORM\OneToOne(inversedBy: 'intangible', targetEntity: IntangiblePriceAndDiscount::class, cascade: ['persist'])]
- protected IntangiblePriceAndDiscount $intangiblePriceAndDiscount;
- public function __construct()
- {
- $this->educationCurriculums = new ArrayCollection();
- $this->accessIntangibles = new ArrayCollection();
- $this->tags = new ArrayCollection();
- $this->educationCurriculumPacks = new ArrayCollection();
- $this->intangiblePriceAndDiscount = new IntangiblePriceAndDiscount();
- parent::__construct();
- }
- public function getDiscr(): ?string
- {
- return $this->discr;
- }
- public function setDiscr(string $discr): self
- {
- $this->discr = $discr;
- return $this;
- }
- public function getOrganization(): ?Organization
- {
- return $this->organization;
- }
- public function setOrganization(?Organization $organization): self
- {
- $this->organization = $organization;
- return $this;
- }
- /**
- * @return Collection<int, EducationCurriculum>
- */
- public function getEducationCurriculums(): Collection
- {
- return $this->educationCurriculums;
- }
- public function addEducationCurriculum(EducationCurriculum $educationCurriculum): self
- {
- if (!$this->educationCurriculums->contains($educationCurriculum)) {
- $this->educationCurriculums[] = $educationCurriculum;
- }
- return $this;
- }
- public function removeEducationCurriculum(EducationCurriculum $educationCurriculum): self
- {
- $this->educationCurriculums->removeElement($educationCurriculum);
- return $this;
- }
- /**
- * @return Collection<int, AccessIntangible>
- */
- public function getAccessIntangibles(): Collection
- {
- return $this->accessIntangibles;
- }
- public function addAccessIntangible(AccessIntangible $accessIntangible): self
- {
- if (!$this->accessIntangibles->contains($accessIntangible)) {
- $this->accessIntangibles[] = $accessIntangible;
- $accessIntangible->setIntangible($this);
- }
- return $this;
- }
- public function removeAccessIntangible(AccessIntangible $accessIntangible): self
- {
- if ($this->accessIntangibles->removeElement($accessIntangible)) {
- // set the owning side to null (unless already changed)
- if ($accessIntangible->getIntangible() === $this) {
- $accessIntangible->setIntangible(null);
- }
- }
- return $this;
- }
- /**
- * @return Collection<int, Tagg>
- */
- public function getTags(): Collection
- {
- return $this->tags;
- }
- public function addTag(Tagg $tag): self
- {
- if (!$this->tags->contains($tag)) {
- $this->tags[] = $tag;
- }
- return $this;
- }
- public function removeTag(Tagg $tag): self
- {
- $this->tags->removeElement($tag);
- return $this;
- }
- function getEducationCurriculumPacks(): Collection
- {
- return $this->educationCurriculumPacks;
- }
- function setEducationCurriculumPacks(Collection $educationCurriculumPacks): self
- {
- $this->educationCurriculumPacks = $educationCurriculumPacks;
- return $this;
- }
- function getIntangiblePriceAndDiscount(): IntangiblePriceAndDiscount
- {
- return $this->intangiblePriceAndDiscount;
- }
- function addEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
- {
- if (!$this->educationCurriculumPacks->contains($educationCurriculumPack)) {
- $this->educationCurriculumPacks[] = $educationCurriculumPack;
- }
- return $this;
- }
- function removeEducationCurriculumPack(EducationCurriculumPack $educationCurriculumPack): self
- {
- $this->educationCurriculumPacks->removeElement($educationCurriculumPack);
- return $this;
- }
- }
|