src/Entity/Size.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SizeRepository;
  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=SizeRepository::class)
  10.  */
  11. class Size
  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\OneToMany(targetEntity=Bike::class, mappedBy="size")
  25.      */
  26.     private $bikes;
  27.     /**
  28.      * @ORM\Column(type="datetime_immutable")
  29.      * @Gedmo\Timestampable(on="create")
  30.      */
  31.     private $created_at;
  32.     /**
  33.      * @ORM\Column(type="datetime_immutable")
  34.      * @Gedmo\Timestampable(on="update")
  35.      */
  36.     private $updated_at;
  37.     public function __construct()
  38.     {
  39.         $this->bikes = new ArrayCollection();
  40.     }
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function getTitle(): ?string
  46.     {
  47.         return $this->title;
  48.     }
  49.     public function setTitle(string $title): self
  50.     {
  51.         $this->title $title;
  52.         return $this;
  53.     }
  54.     /**
  55.      * @return Collection<int, Bike>
  56.      */
  57.     public function getBikes(): Collection
  58.     {
  59.         return $this->bikes;
  60.     }
  61.     public function addBike(Bike $bike): self
  62.     {
  63.         if (!$this->bikes->contains($bike)) {
  64.             $this->bikes[] = $bike;
  65.             $bike->setSize($this);
  66.         }
  67.         return $this;
  68.     }
  69.     public function removeBike(Bike $bike): self
  70.     {
  71.         if ($this->bikes->removeElement($bike)) {
  72.             // set the owning side to null (unless already changed)
  73.             if ($bike->getSize() === $this) {
  74.                 $bike->setSize(null);
  75.             }
  76.         }
  77.         return $this;
  78.     }
  79.     public function getCreatedAt(): ?\DateTimeImmutable
  80.     {
  81.         return $this->created_at;
  82.     }
  83.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  84.     {
  85.         $this->created_at $created_at;
  86.         return $this;
  87.     }
  88.     public function getUpdatedAt(): ?\DateTimeImmutable
  89.     {
  90.         return $this->updated_at;
  91.     }
  92.     public function setUpdatedAt(\DateTimeImmutable $updated_at): self
  93.     {
  94.         $this->updated_at $updated_at;
  95.         return $this;
  96.     }
  97. }