diff --git a/src/Entity/ModelType.php b/src/Entity/ModelType.php index 832501d..7cd92ab 100644 --- a/src/Entity/ModelType.php +++ b/src/Entity/ModelType.php @@ -130,16 +130,40 @@ class ModelType #[ORM\OneToMany(mappedBy: 'typeProduct', targetEntity: CustomField::class)] private Collection $productCustomFields; + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: SkeletonPieceRequirement::class, mappedBy: 'modelType', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['position' => 'ASC'])] + private Collection $skeletonPieceRequirements; + + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: SkeletonProductRequirement::class, mappedBy: 'modelType', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['position' => 'ASC'])] + private Collection $skeletonProductRequirements; + + /** + * @var Collection + */ + #[ORM\OneToMany(targetEntity: SkeletonSubcomponentRequirement::class, mappedBy: 'modelType', cascade: ['persist', 'remove'], orphanRemoval: true)] + #[ORM\OrderBy(['position' => 'ASC'])] + private Collection $skeletonSubcomponentRequirements; + public function __construct() { - $this->createdAt = new DateTimeImmutable(); - $this->updatedAt = new DateTimeImmutable(); - $this->composants = new ArrayCollection(); - $this->pieces = new ArrayCollection(); - $this->products = new ArrayCollection(); - $this->customFields = new ArrayCollection(); - $this->pieceCustomFields = new ArrayCollection(); - $this->productCustomFields = new ArrayCollection(); + $this->createdAt = new DateTimeImmutable(); + $this->updatedAt = new DateTimeImmutable(); + $this->composants = new ArrayCollection(); + $this->pieces = new ArrayCollection(); + $this->products = new ArrayCollection(); + $this->customFields = new ArrayCollection(); + $this->pieceCustomFields = new ArrayCollection(); + $this->productCustomFields = new ArrayCollection(); + $this->skeletonPieceRequirements = new ArrayCollection(); + $this->skeletonProductRequirements = new ArrayCollection(); + $this->skeletonSubcomponentRequirements = new ArrayCollection(); } public function getName(): string @@ -291,6 +315,81 @@ class ModelType return $this->productCustomFields; } + /** + * @return Collection + */ + public function getSkeletonPieceRequirements(): Collection + { + return $this->skeletonPieceRequirements; + } + + public function addSkeletonPieceRequirement(SkeletonPieceRequirement $requirement): static + { + if (!$this->skeletonPieceRequirements->contains($requirement)) { + $this->skeletonPieceRequirements->add($requirement); + $requirement->setModelType($this); + } + + return $this; + } + + public function removeSkeletonPieceRequirement(SkeletonPieceRequirement $requirement): static + { + $this->skeletonPieceRequirements->removeElement($requirement); + + return $this; + } + + /** + * @return Collection + */ + public function getSkeletonProductRequirements(): Collection + { + return $this->skeletonProductRequirements; + } + + public function addSkeletonProductRequirement(SkeletonProductRequirement $requirement): static + { + if (!$this->skeletonProductRequirements->contains($requirement)) { + $this->skeletonProductRequirements->add($requirement); + $requirement->setModelType($this); + } + + return $this; + } + + public function removeSkeletonProductRequirement(SkeletonProductRequirement $requirement): static + { + $this->skeletonProductRequirements->removeElement($requirement); + + return $this; + } + + /** + * @return Collection + */ + public function getSkeletonSubcomponentRequirements(): Collection + { + return $this->skeletonSubcomponentRequirements; + } + + public function addSkeletonSubcomponentRequirement(SkeletonSubcomponentRequirement $requirement): static + { + if (!$this->skeletonSubcomponentRequirements->contains($requirement)) { + $this->skeletonSubcomponentRequirements->add($requirement); + $requirement->setModelType($this); + } + + return $this; + } + + public function removeSkeletonSubcomponentRequirement(SkeletonSubcomponentRequirement $requirement): static + { + $this->skeletonSubcomponentRequirements->removeElement($requirement); + + return $this; + } + private function applyStructureForCategory(?array $structure, ModelCategory $category): void { if (ModelCategory::COMPONENT === $category) { diff --git a/src/Entity/SkeletonPieceRequirement.php b/src/Entity/SkeletonPieceRequirement.php new file mode 100644 index 0000000..6817210 --- /dev/null +++ b/src/Entity/SkeletonPieceRequirement.php @@ -0,0 +1,81 @@ + 0])] + private int $position = 0; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')] + private DateTimeImmutable $createdAt; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'updatedAt')] + private DateTimeImmutable $updatedAt; + + public function __construct() + { + $this->createdAt = new DateTimeImmutable(); + $this->updatedAt = new DateTimeImmutable(); + } + + public function getModelType(): ModelType + { + return $this->modelType; + } + + public function setModelType(ModelType $modelType): static + { + $this->modelType = $modelType; + + return $this; + } + + public function getTypePiece(): ModelType + { + return $this->typePiece; + } + + public function setTypePiece(ModelType $typePiece): static + { + $this->typePiece = $typePiece; + + return $this; + } + + public function getPosition(): int + { + return $this->position; + } + + public function setPosition(int $position): static + { + $this->position = $position; + + return $this; + } +} diff --git a/src/Entity/SkeletonProductRequirement.php b/src/Entity/SkeletonProductRequirement.php new file mode 100644 index 0000000..bda5740 --- /dev/null +++ b/src/Entity/SkeletonProductRequirement.php @@ -0,0 +1,96 @@ + 0])] + private int $position = 0; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')] + private DateTimeImmutable $createdAt; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'updatedAt')] + private DateTimeImmutable $updatedAt; + + public function __construct() + { + $this->createdAt = new DateTimeImmutable(); + $this->updatedAt = new DateTimeImmutable(); + } + + public function getModelType(): ModelType + { + return $this->modelType; + } + + public function setModelType(ModelType $modelType): static + { + $this->modelType = $modelType; + + return $this; + } + + public function getTypeProduct(): ModelType + { + return $this->typeProduct; + } + + public function setTypeProduct(ModelType $typeProduct): static + { + $this->typeProduct = $typeProduct; + + return $this; + } + + public function getFamilyCode(): ?string + { + return $this->familyCode; + } + + public function setFamilyCode(?string $familyCode): static + { + $this->familyCode = $familyCode; + + return $this; + } + + public function getPosition(): int + { + return $this->position; + } + + public function setPosition(int $position): static + { + $this->position = $position; + + return $this; + } +} diff --git a/src/Entity/SkeletonSubcomponentRequirement.php b/src/Entity/SkeletonSubcomponentRequirement.php new file mode 100644 index 0000000..da3e037 --- /dev/null +++ b/src/Entity/SkeletonSubcomponentRequirement.php @@ -0,0 +1,111 @@ + 0])] + private int $position = 0; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'createdAt')] + private DateTimeImmutable $createdAt; + + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, name: 'updatedAt')] + private DateTimeImmutable $updatedAt; + + public function __construct() + { + $this->createdAt = new DateTimeImmutable(); + $this->updatedAt = new DateTimeImmutable(); + } + + public function getModelType(): ModelType + { + return $this->modelType; + } + + public function setModelType(ModelType $modelType): static + { + $this->modelType = $modelType; + + return $this; + } + + public function getAlias(): string + { + return $this->alias; + } + + public function setAlias(string $alias): static + { + $this->alias = $alias; + + return $this; + } + + public function getFamilyCode(): string + { + return $this->familyCode; + } + + public function setFamilyCode(string $familyCode): static + { + $this->familyCode = $familyCode; + + return $this; + } + + public function getTypeComposant(): ?ModelType + { + return $this->typeComposant; + } + + public function setTypeComposant(?ModelType $typeComposant): static + { + $this->typeComposant = $typeComposant; + + return $this; + } + + public function getPosition(): int + { + return $this->position; + } + + public function setPosition(int $position): static + { + $this->position = $position; + + return $this; + } +}