<?php
namespace App\Entity;
use App\Repository\BikeRepository;
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=BikeRepository::class)
*/
class Bike
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $reference;
/**
* @ORM\Column(type="string", length=255)
*/
private $description;
/**
* @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="bikes")
*/
private $agency;
/**
* @ORM\ManyToOne(targetEntity=Category::class, inversedBy="bikes")
*/
private $category;
/**
* @ORM\ManyToOne(targetEntity=Kind::class, inversedBy="bikes")
*/
private $kind;
/**
* @ORM\ManyToOne(targetEntity=Size::class, inversedBy="bikes")
*/
private $size;
/**
* @ORM\ManyToOne(targetEntity=Brand::class, inversedBy="bikes")
*/
private $brand;
/**
* @ORM\OneToMany(targetEntity=History::class, mappedBy="bike")
* @ORM\JoinColumn(name="history_id", referencedColumnName="id", nullable=true)
*/
private $histories;
/**
* @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="bike")
*/
private $orderParticipantBikes;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="create")
*/
private $created_at;
/**
* @ORM\Column(type="datetime_immutable")
* @Gedmo\Timestampable(on="update")
*/
private $updated_at;
public function __construct()
{
$this->histories = new ArrayCollection();
$this->orderParticipantBikes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getReference(): ?string
{
return $this->reference;
}
public function setReference(string $reference): self
{
$this->reference = $reference;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(string $description): self
{
$this->description = $description;
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;
}
public function getCategory(): ?Category
{
return $this->category;
}
public function setCategory(?Category $category): self
{
$this->category = $category;
return $this;
}
public function getKind(): ?Kind
{
return $this->kind;
}
public function setKind(?Kind $kind): self
{
$this->kind = $kind;
return $this;
}
public function getSize(): ?Size
{
return $this->size;
}
public function setSize(?Size $size): self
{
$this->size = $size;
return $this;
}
public function getBrand(): ?Brand
{
return $this->brand;
}
public function setBrand(?Brand $brand): self
{
$this->brand = $brand;
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->setBike($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->getBike() === $this) {
$history->setBike(null);
}
}
return $this;
}
/**
* @return Collection<int, OrderParticipantBike>
*/
public function getOrderParticipantBikes(): Collection
{
return $this->orderParticipantBikes;
}
public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
$this->orderParticipantBikes[] = $orderParticipantBike;
$orderParticipantBike->setBike($this);
}
return $this;
}
public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
{
if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
// set the owning side to null (unless already changed)
if ($orderParticipantBike->getBike() === $this) {
$orderParticipantBike->setBike(null);
}
}
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;
}
}