src/Entity/Kind.php line 14

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