src/Entity/Accessory.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\AccessoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=AccessoryRepository::class)
  10.  */
  11. class Accessory
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $title;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $reference;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $price;
  31.     /**
  32.      * @ORM\Column(type="boolean")
  33.      */
  34.     private $statut;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $principal_image;
  39.     /**
  40.      * @ORM\Column(type="array")
  41.      */
  42.     private $multiple_image = [];
  43.     
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=Agency::class, inversedBy="accessory")
  46.      */
  47.     private $agency;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=History::class, mappedBy="accessory")
  50.      */
  51.     private $histories;
  52.     
  53.     /**
  54.      * @ORM\ManyToMany(targetEntity=Order::class, mappedBy="accessory")
  55.      */
  56.     private $orders;
  57.     /**
  58.      * @ORM\Column(type="datetime_immutable")
  59.      * @Gedmo\Timestampable(on="create")
  60.      */
  61.     private $created_at;
  62.     /**
  63.      * @ORM\Column(type="datetime_immutable")
  64.      * @Gedmo\Timestampable(on="update")
  65.      */
  66.     private $updated_at;
  67.     /**
  68.      * @ORM\ManyToOne(targetEntity=CategoryAccessory::class, inversedBy="accessory")
  69.      */
  70.     private $categoryAccessory;
  71.     public function __construct()
  72.     {
  73.         $this->histories = new ArrayCollection();
  74.         $this->orders = new ArrayCollection();
  75.     }
  76.     public function getId(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     public function getTitle(): ?string
  81.     {
  82.         return $this->title;
  83.     }
  84.     public function setTitle(string $title): self
  85.     {
  86.         $this->title $title;
  87.         return $this;
  88.     }
  89.     public function getReference(): ?string
  90.     {
  91.         return $this->reference;
  92.     }
  93.     public function setReference(string $reference): self
  94.     {
  95.         $this->reference $reference;
  96.         return $this;
  97.     }
  98.     public function getPrice(): ?string
  99.     {
  100.         return $this->price;
  101.     }
  102.     public function setPrice(string $price): self
  103.     {
  104.         $this->price $price;
  105.         return $this;
  106.     }
  107.     public function isStatut(): ?bool
  108.     {
  109.         return $this->statut;
  110.     }
  111.     public function setStatut(bool $statut): self
  112.     {
  113.         $this->statut $statut;
  114.         return $this;
  115.     }
  116.     public function getPrincipalImage(): ?string
  117.     {
  118.         return $this->principal_image;
  119.     }
  120.     public function setPrincipalImage(string $principal_image): self
  121.     {
  122.         $this->principal_image $principal_image;
  123.         return $this;
  124.     }
  125.     
  126.     public function getMultipleImage(): ?array
  127.     {
  128.         return $this->multiple_image;
  129.     }
  130.     public function setMultipleImage(array $multiple_image): self
  131.     {
  132.         $this->multiple_image $multiple_image;
  133.         return $this;
  134.     }
  135.     public function getAgency(): ?Agency
  136.     {
  137.         return $this->agency;
  138.     }
  139.     public function setAgency(?Agency $agency): self
  140.     {
  141.         $this->agency $agency;
  142.         return $this;
  143.     }
  144.     /**
  145.      * @return Collection<int, History>
  146.      */
  147.     public function getHistories(): Collection
  148.     {
  149.         return $this->histories;
  150.     }
  151.     public function addHistory(History $history): self
  152.     {
  153.         if (!$this->histories->contains($history)) {
  154.             $this->histories[] = $history;
  155.             $history->setAccessory($this);
  156.         }
  157.         return $this;
  158.     }
  159.     public function removeHistory(History $history): self
  160.     {
  161.         if ($this->histories->removeElement($history)) {
  162.             // set the owning side to null (unless already changed)
  163.             if ($history->getAccessory() === $this) {
  164.                 $history->setAccessory(null);
  165.             }
  166.         }
  167.         return $this;
  168.     }
  169.     
  170.     /**
  171.      * @return Collection<int, Order>
  172.      */
  173.     public function getOrders(): Collection
  174.     {
  175.         return $this->orders;
  176.     }
  177.     public function addOrder(Order $order): self
  178.     {
  179.         if (!$this->orders->contains($order)) {
  180.             $this->orders[] = $order;
  181.             $order->addAccessory($this);
  182.         }
  183.         return $this;
  184.     }
  185.     public function removeOrder(Order $order): self
  186.     {
  187.         if ($this->orders->removeElement($order)) {
  188.             $order->removeAccessory($this);
  189.         }
  190.         return $this;
  191.     }
  192.     
  193.     public function getCreatedAt(): ?\DateTimeImmutable
  194.     {
  195.         return $this->created_at;
  196.     }
  197.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  198.     {
  199.         $this->created_at $created_at;
  200.         return $this;
  201.     }
  202.     public function getUpdatedAt(): ?\DateTimeImmutable
  203.     {
  204.         return $this->updated_at;
  205.     }
  206.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  207.     {
  208.         $this->updated_at $updated_at;
  209.         return $this;
  210.     }
  211.     public function getCategoryAccessory(): ?CategoryAccessory
  212.     {
  213.         return $this->categoryAccessory;
  214.     }
  215.     public function setCategoryAccessory(?CategoryAccessory $categoryAccessory): self
  216.     {
  217.         $this->categoryAccessory $categoryAccessory;
  218.         return $this;
  219.     }
  220. }