*/ #[ORM\ManyToMany(targetEntity: Constructeur::class, inversedBy: 'machines')] #[ORM\JoinTable( name: '_MachineConstructeurs', joinColumns: [new ORM\JoinColumn(name: 'A', referencedColumnName: 'id', onDelete: 'CASCADE')], inverseJoinColumns: [new ORM\InverseJoinColumn(name: 'B', referencedColumnName: 'id', onDelete: 'CASCADE')] )] private Collection $constructeurs; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: MachineComponentLink::class)] private Collection $componentLinks; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: MachinePieceLink::class)] private Collection $pieceLinks; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: MachineProductLink::class)] private Collection $productLinks; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: Document::class)] private Collection $documents; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: CustomField::class, cascade: ['persist', 'remove'])] private Collection $customFields; /** * @var Collection */ #[ORM\OneToMany(mappedBy: 'machine', targetEntity: CustomFieldValue::class)] private Collection $customFieldValues; #[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() { $now = new DateTimeImmutable(); $this->createdAt = $now; $this->updatedAt = $now; $this->constructeurs = new ArrayCollection(); $this->componentLinks = new ArrayCollection(); $this->pieceLinks = new ArrayCollection(); $this->productLinks = new ArrayCollection(); $this->documents = new ArrayCollection(); $this->customFields = new ArrayCollection(); $this->customFieldValues = new ArrayCollection(); } public function getName(): string { return $this->name; } public function setName(string $name): static { $this->name = $name; return $this; } public function getReference(): ?string { return $this->reference; } public function setReference(?string $reference): static { $this->reference = $reference; return $this; } public function getPrix(): ?string { return $this->prix; } public function setPrix(?string $prix): static { $this->prix = $prix; return $this; } public function getSite(): ?Site { return $this->site; } public function setSite(?Site $site): static { $this->site = $site; return $this; } /** * @return Collection */ public function getCustomFields(): Collection { return $this->customFields; } public function addCustomField(CustomField $customField): static { if (!$this->customFields->contains($customField)) { $this->customFields->add($customField); $customField->setMachine($this); } return $this; } public function removeCustomField(CustomField $customField): static { if ($this->customFields->removeElement($customField)) { if ($customField->getMachine() === $this) { $customField->setMachine(null); } } return $this; } /** * @return Collection */ public function getConstructeurs(): Collection { return $this->constructeurs; } /** * @return Collection */ public function getComponentLinks(): Collection { return $this->componentLinks; } /** * @return Collection */ public function getPieceLinks(): Collection { return $this->pieceLinks; } /** * @return Collection */ public function getProductLinks(): Collection { return $this->productLinks; } /** * @return Collection */ public function getDocuments(): Collection { return $this->documents; } /** * @return Collection */ public function getCustomFieldValues(): Collection { return $this->customFieldValues; } }