src/Entity/Brand.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BrandRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=BrandRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class Brand
  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 $name;
  23.     /**
  24.      * @ORM\Column(type="string", length=255, nullable=true)
  25.      */
  26.     private $image;
  27.     /**
  28.      * @ORM\Column(type="datetime")
  29.      */
  30.     private $createdAt;
  31.     /**
  32.      * @ORM\Column(type="datetime", nullable=true)
  33.      */
  34.     private $updatedAt;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Car::class, mappedBy="brand")
  37.      */
  38.     private $carId;
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true)
  41.      */
  42.     private $infoautoId;
  43.     public function __construct()
  44.     {
  45.         $this->carId = new ArrayCollection();
  46.     }
  47.     public function getId(): ?int
  48.     {
  49.         return $this->id;
  50.     }
  51.     public function getName(): ?string
  52.     {
  53.         return $this->name;
  54.     }
  55.     public function setName(string $name): self
  56.     {
  57.         $this->name $name;
  58.         return $this;
  59.     }
  60.     public function getImage(): ?string
  61.     {
  62.         return $this->image;
  63.     }
  64.     public function setImage(?string $image): self
  65.     {
  66.         $this->image $image;
  67.         return $this;
  68.     }
  69.     public function getCreatedAt(): ?\DateTimeInterface
  70.     {
  71.         return $this->createdAt;
  72.     }
  73.     /**
  74.      * @ORM\PrePersist
  75.      */
  76.     public function setCreatedAt(): self
  77.     {
  78.         $this->createdAt = new \DateTime();
  79.         return $this;
  80.     }
  81.     public function getUpdatedAt(): ?\DateTimeInterface
  82.     {
  83.         return $this->updatedAt;
  84.     }
  85.     /**
  86.      * @ORM\PreUpdate
  87.      */
  88.     public function setUpdatedAt(): self
  89.     {
  90.         $this->updatedAt = new \DateTime();
  91.         return $this;
  92.     }
  93.     /**
  94.      * @return Collection|Car[]
  95.      */
  96.     public function getCarId(): Collection
  97.     {
  98.         return $this->carId;
  99.     }
  100.     public function addCarId(Car $carId): self
  101.     {
  102.         if (!$this->carId->contains($carId)) {
  103.             $this->carId[] = $carId;
  104.             $carId->setBrand($this);
  105.         }
  106.         return $this;
  107.     }
  108.     public function removeCarId(Car $carId): self
  109.     {
  110.         if ($this->carId->removeElement($carId)) {
  111.             // set the owning side to null (unless already changed)
  112.             if ($carId->getBrand() === $this) {
  113.                 $carId->setBrand(null);
  114.             }
  115.         }
  116.         return $this;
  117.     }
  118.     public function __toString()
  119.     {
  120.         return $this->name;
  121.     }
  122.     public function getInfoautoId(): ?int
  123.     {
  124.         return $this->infoautoId;
  125.     }
  126.     public function setInfoautoId(?int $infoautoId): self
  127.     {
  128.         $this->infoautoId $infoautoId;
  129.         return $this;
  130.     }
  131. }