src/Entity/Bike.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BikeRepository;
  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=BikeRepository::class)
  10.  */
  11. class Bike
  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 $reference;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\Column(type="boolean")
  29.      */
  30.     private $statut;
  31.     /**
  32.      * @ORM\Column(type="string", length=255)
  33.      */
  34.     private $principal_image;
  35.     /**
  36.      * @ORM\Column(type="array")
  37.      */
  38.     private $multiple_image = [];
  39.     /**
  40.      * @ORM\ManyToOne(targetEntity=Agency::class, inversedBy="bikes")
  41.      */
  42.     private $agency;
  43.     /**
  44.      * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="bikes")
  45.      */
  46.     private $category;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=Kind::class, inversedBy="bikes")
  49.      */
  50.     private $kind;
  51.     /**
  52.      * @ORM\ManyToOne(targetEntity=Size::class, inversedBy="bikes")
  53.      */
  54.     private $size;
  55.     /**
  56.      * @ORM\ManyToOne(targetEntity=Brand::class, inversedBy="bikes")
  57.      */
  58.     private $brand;
  59.     /**
  60.      * @ORM\OneToMany(targetEntity=History::class, mappedBy="bike")
  61.      * @ORM\JoinColumn(name="history_id", referencedColumnName="id", nullable=true)
  62.      */
  63.     private $histories;
  64.     /**
  65.      * @ORM\OneToMany(targetEntity=OrderParticipantBike::class, mappedBy="bike")
  66.      */
  67.     private $orderParticipantBikes;
  68.     /**
  69.      * @ORM\Column(type="datetime_immutable")
  70.      * @Gedmo\Timestampable(on="create")
  71.      */
  72.     private $created_at;
  73.     /**
  74.      * @ORM\Column(type="datetime_immutable")
  75.      * @Gedmo\Timestampable(on="update")
  76.      */
  77.     private $updated_at;
  78.     public function __construct()
  79.     {
  80.         $this->histories = new ArrayCollection();
  81.         $this->orderParticipantBikes = new ArrayCollection();
  82.     }
  83.     public function getId(): ?int
  84.     {
  85.         return $this->id;
  86.     }
  87.     public function getReference(): ?string
  88.     {
  89.         return $this->reference;
  90.     }
  91.     public function setReference(string $reference): self
  92.     {
  93.         $this->reference $reference;
  94.         return $this;
  95.     }
  96.     public function getDescription(): ?string
  97.     {
  98.         return $this->description;
  99.     }
  100.     public function setDescription(string $description): self
  101.     {
  102.         $this->description $description;
  103.         return $this;
  104.     }
  105.     public function isStatut(): ?bool
  106.     {
  107.         return $this->statut;
  108.     }
  109.     public function setStatut(bool $statut): self
  110.     {
  111.         $this->statut $statut;
  112.         return $this;
  113.     }
  114.     public function getPrincipalImage(): ?string
  115.     {
  116.         return $this->principal_image;
  117.     }
  118.     public function setPrincipalImage(string $principal_image): self
  119.     {
  120.         $this->principal_image $principal_image;
  121.         return $this;
  122.     }
  123.     public function getMultipleImage(): ?array
  124.     {
  125.         return $this->multiple_image;
  126.     }
  127.     public function setMultipleImage(array $multiple_image): self
  128.     {
  129.         $this->multiple_image $multiple_image;
  130.         return $this;
  131.     }
  132.     public function getAgency(): ?Agency
  133.     {
  134.         return $this->agency;
  135.     }
  136.     public function setAgency(?Agency $agency): self
  137.     {
  138.         $this->agency $agency;
  139.         return $this;
  140.     }
  141.     public function getCategory(): ?Category
  142.     {
  143.         return $this->category;
  144.     }
  145.     public function setCategory(?Category $category): self
  146.     {
  147.         $this->category $category;
  148.         return $this;
  149.     }
  150.     
  151.     public function getKind(): ?Kind
  152.     {
  153.         return $this->kind;
  154.     }
  155.     public function setKind(?Kind $kind): self
  156.     {
  157.         $this->kind $kind;
  158.         return $this;
  159.     }
  160.     public function getSize(): ?Size
  161.     {
  162.         return $this->size;
  163.     }
  164.     public function setSize(?Size $size): self
  165.     {
  166.         $this->size $size;
  167.         return $this;
  168.     }
  169.     public function getBrand(): ?Brand
  170.     {
  171.         return $this->brand;
  172.     }
  173.     public function setBrand(?Brand $brand): self
  174.     {
  175.         $this->brand $brand;
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, History>
  180.      */
  181.     public function getHistories(): Collection
  182.     {
  183.         return $this->histories;
  184.     }
  185.     public function addHistory(History $history): self
  186.     {
  187.         if (!$this->histories->contains($history)) {
  188.             $this->histories[] = $history;
  189.             $history->setBike($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeHistory(History $history): self
  194.     {
  195.         if ($this->histories->removeElement($history)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($history->getBike() === $this) {
  198.                 $history->setBike(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, OrderParticipantBike>
  205.      */
  206.     public function getOrderParticipantBikes(): Collection
  207.     {
  208.         return $this->orderParticipantBikes;
  209.     }
  210.     public function addOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  211.     {
  212.         if (!$this->orderParticipantBikes->contains($orderParticipantBike)) {
  213.             $this->orderParticipantBikes[] = $orderParticipantBike;
  214.             $orderParticipantBike->setBike($this);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeOrderParticipantBike(OrderParticipantBike $orderParticipantBike): self
  219.     {
  220.         if ($this->orderParticipantBikes->removeElement($orderParticipantBike)) {
  221.             // set the owning side to null (unless already changed)
  222.             if ($orderParticipantBike->getBike() === $this) {
  223.                 $orderParticipantBike->setBike(null);
  224.             }
  225.         }
  226.         return $this;
  227.     }
  228.     public function getCreatedAt(): ?\DateTimeImmutable
  229.     {
  230.         return $this->created_at;
  231.     }
  232.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  233.     {
  234.         $this->created_at $created_at;
  235.         return $this;
  236.     }
  237.     public function getUpdatedAt(): ?\DateTimeImmutable
  238.     {
  239.         return $this->updated_at;
  240.     }
  241.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  242.     {
  243.         $this->updated_at $updated_at;
  244.         return $this;
  245.     }
  246. }