<?php
namespace App\Entity;
use App\Repository\AccessoryRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=AccessoryRepository::class)
*/
class Accessory
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
*/
private $reference;
/**
* @ORM\Column(type="string", length=255)
*/
private $price;
/**
* @ORM\Column(type="boolean")
*/
private $statut;
/**
* @ORM\Column(type="string", length=255)
*/
private $principal_image;
/**
* @ORM\Column(type="array")
*/
private $multiple_image = [];
/**
* @ORM\ManyToOne(targetEntity=Agency::class, inversedBy="accessory")
*/
private $agency;
/**
* @ORM\OneToMany(targetEntity=History::class, mappedBy="accessory")
*/
private $histories;
/**
* @ORM\ManyToMany(targetEntity=Order::class, mappedBy="accessory")
*/
private $orders;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="create")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="update")
*/
private $updated_at;
/**
* @ORM\ManyToOne(targetEntity=CategoryAccessory::class, inversedBy="accessory")
*/
private $categoryAccessory;
public function __construct()
{
$this->histories = new ArrayCollection();
$this->orders = 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 getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getPrice(): ?string
{
return $this->price;
}
public function setPrice(string $price): self
{
$this->price = $price;
return $this;
}
public function isStatut(): ?bool
{
return $this->statut;
}
public function setStatut(bool $statut): self
{
$this->statut = $statut;
return $this;
}
public function getPrincipalImage(): ?string
{
return $this->principal_image;
}
public function setPrincipalImage(string $principal_image): self
{
$this->principal_image = $principal_image;
return $this;
}
public function getMultipleImage(): ?array
{
return $this->multiple_image;
}
public function setMultipleImage(array $multiple_image): self
{
$this->multiple_image = $multiple_image;
return $this;
}
public function getAgency(): ?Agency
{
return $this->agency;
}
public function setAgency(?Agency $agency): self
{
$this->agency = $agency;
return $this;
}
/**
* @return Collection<int, History>
*/
public function getHistories(): Collection
{
return $this->histories;
}
public function addHistory(History $history): self
{
if (!$this->histories->contains($history)) {
$this->histories[] = $history;
$history->setAccessory($this);
}
return $this;
}
public function removeHistory(History $history): self
{
if ($this->histories->removeElement($history)) {
// set the owning side to null (unless already changed)
if ($history->getAccessory() === $this) {
$history->setAccessory(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->addAccessory($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
if ($this->orders->removeElement($order)) {
$order->removeAccessory($this);
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
return $this;
}
public function getUpdatedAt(): ?\DateTimeImmutable
{
return $this->updated_at;
}
public function setUpdatedAt(\DateTimeImmutable $updated_at): self
{
$this->updated_at = $updated_at;
return $this;
}
public function getCategoryAccessory(): ?CategoryAccessory
{
return $this->categoryAccessory;
}
public function setCategoryAccessory(?CategoryAccessory $categoryAccessory): self
{
$this->categoryAccessory = $categoryAccessory;
return $this;
}
}