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/Product.php
<?php namespace App\Entity; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * @ORM\Entity(repositoryClass="App\Repository\ProductRepository") */ class Product { /** * @ORM\Id() * @ORM\GeneratedValue() * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="text") * @Assert\NotBlank(message="Le champ ne peut pas ĂȘtre vide!") */ private $content; /** * @ORM\Column(type="datetime") */ private $createdAt; /** * @ORM\Column(type="datetime") */ private $updatedAt; /** * @ORM\Column(type="boolean") */ private $isActive; /** * @ORM\OneToMany(targetEntity="App\Entity\ProductImage", mappedBy="product", cascade={"persist", "remove", "merge"}) */ private $images; /** * @ORM\ManyToOne(targetEntity="App\Entity\Category", inversedBy="products") */ private $category; /** * @ORM\ManyToMany(targetEntity="App\Entity\Metal", inversedBy="products") */ private $metals; /** * @ORM\ManyToOne(targetEntity="App\Entity\CollectionJewellery", inversedBy="products") */ private $collectionJewellery; /** * @ORM\Column(type="boolean") */ private $isHome; public function __construct() { $this->isActive = true; $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); $this->images = new ArrayCollection(); $this->metals = new ArrayCollection(); } 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 getContent(): ?string { return $this->content; } public function setContent(string $content): self { $this->content = $content; 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; } public function getIsActive(): ?bool { return $this->isActive; } public function setIsActive(bool $isActive): self { $this->isActive = $isActive; return $this; } /** * @return Collection|ProductImage[] */ public function getImages(): Collection { return $this->images; } public function addImage(ProductImage $image): self { if (!$this->images->contains($image)) { $this->images[] = $image; $image->setProduct($this); } return $this; } public function removeImage(ProductImage $image): self { if ($this->images->contains($image)) { $this->images->removeElement($image); // set the owning side to null (unless already changed) if ($image->getProduct() === $this) { $image->setProduct(null); } } return $this; } public function getCategory(): ?Category { return $this->category; } public function setCategory(?Category $category): self { $this->category = $category; return $this; } /** * @return Collection|Metal[] */ public function getMetals(): Collection { return $this->metals; } public function addMetal(Metal $metal): self { if (!$this->metals->contains($metal)) { $this->metals[] = $metal; } return $this; } public function removeMetal(Metal $metal): self { if ($this->metals->contains($metal)) { $this->metals->removeElement($metal); } return $this; } public function getCollectionJewellery(): ?CollectionJewellery { return $this->collectionJewellery; } public function setCollectionJewellery(?CollectionJewellery $collectionJewellery): self { $this->collectionJewellery = $collectionJewellery; return $this; } public function getIsHome(): ?bool { return $this->isHome; } public function setIsHome(bool $isHome): self { $this->isHome = $isHome; return $this; } }