<?phpnamespace App\Entity;use App\Repository\StockDePiecesRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: StockDePiecesRepository::class)]class StockDePieces{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255, nullable: true)] private ?string $nomPiece = null; #[ORM\Column(nullable: true)] private ?int $prix = null; #[ORM\Column(nullable: true)] private ?int $quantite = null; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $createdAt = null; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $updatedAt = null; #[ORM\Column(length: 255, nullable: true)] private ?string $reference = null; #[ORM\OneToMany(mappedBy: 'stockPieces', targetEntity: StockDePiecesTraveaux::class, cascade: ['persist'])] private Collection $stockDePiecesTraveauxes; public function __construct() { $this->createdAt = new \DateTimeImmutable(); $this->updatedAt = new \DateTimeImmutable(); $this->stockDePiecesTraveauxes = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getNomPiece(): ?string { return $this->nomPiece; } public function setNomPiece(?string $nomPiece): static { $this->nomPiece = $nomPiece; return $this; } public function getPrix(): ?int { return $this->prix; } public function setPrix(?int $prix): static { $this->prix = $prix; return $this; } public function getQuantite(): ?int { return $this->quantite; } public function setQuantite(?int $quantite): static { $this->quantite = $quantite; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function setCreatedAt(?\DateTimeImmutable $createdAt): static { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static { $this->updatedAt = $updatedAt; return $this; } public function getReference(): ?string { return $this->reference; } public function setReference(?string $reference): static { $this->reference = $reference; return $this; } /** * @return Collection<int, StockDePiecesTraveaux> */ public function getStockDePiecesTraveauxes(): Collection { return $this->stockDePiecesTraveauxes; } public function addStockDePiecesTraveaux(StockDePiecesTraveaux $stockDePiecesTraveaux): static { if (!$this->stockDePiecesTraveauxes->contains($stockDePiecesTraveaux)) { $this->stockDePiecesTraveauxes->add($stockDePiecesTraveaux); $stockDePiecesTraveaux->setStockPieces($this); } return $this; } public function removeStockDePiecesTraveaux(StockDePiecesTraveaux $stockDePiecesTraveaux): static { if ($this->stockDePiecesTraveauxes->removeElement($stockDePiecesTraveaux)) { // set the owning side to null (unless already changed) if ($stockDePiecesTraveaux->getStockPieces() === $this) { $stockDePiecesTraveaux->setStockPieces(null); } } return $this; } }