Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
srv
/
data
/
trash
/
vhost_www.bachtale.com_1719306535
/
htdocs
/
src
/
Entity
/
//srv/data/trash/vhost_www.bachtale.com_1719306535/htdocs/src/Entity/Metal.php
<?php namespace App\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\ArrayCollection; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; /** * @ORM\Entity(repositoryClass="App\Repository\MetalRepository") * @UniqueEntity( * fields = {"title"}, * message = "La valeur que vous avez indiqué est déjà utilisé !" * ) */ class Metal { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime") */ private $updatedAt; /** * @ORM\ManyToMany(targetEntity="App\Entity\Product", mappedBy="metals") */ private $products; public function __construct() { $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); $this->products = new ArrayCollection(); } public function __toString() { return $this->getTitle(); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): self { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): self { $this->updatedAt = $updatedAt; return $this; } /** * @return Collection|Product[] */ public function getProducts(): Collection { return $this->products; } public function addProduct(Product $product): self { if (!$this->products->contains($product)) { $this->products[] = $product; $product->addMetal($this); } return $this; } public function removeProduct(Product $product): self { if ($this->products->contains($product)) { $this->products->removeElement($product); $product->removeMetal($this); } return $this; } }