src/Entity/Destinations.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DestinationsRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=DestinationsRepository::class)
  9.  * @ORM\HasLifecycleCallbacks()
  10.  */
  11. class Destinations
  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 $description;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, nullable=true)
  29.      */
  30.     private $image;
  31.     /**
  32.      * @ORM\Column(type="datetime")
  33.      */
  34.     private $createdAt;
  35.     /**
  36.      * @ORM\Column(type="datetime", nullable=true)
  37.      */
  38.     private $updatedAt;
  39.     /**
  40.      * @ORM\Column(type="string", length=255)
  41.      */
  42.     private $type;
  43.     /**
  44.      * @ORM\OneToMany(targetEntity=Transfers::class, mappedBy="destination")
  45.      */
  46.     private $transfers;
  47.     /**
  48.      * @ORM\OneToMany(targetEntity=Car::class, mappedBy="destination")
  49.      */
  50.     private $cars;
  51.     public function __construct()
  52.     {
  53.         $this->transfers = new ArrayCollection();
  54.         $this->cars = new ArrayCollection();
  55.     }
  56.     public function getId(): ?int
  57.     {
  58.         return $this->id;
  59.     }
  60.     public function getName(): ?string
  61.     {
  62.         return $this->name;
  63.     }
  64.     public function setName(string $name): self
  65.     {
  66.         $this->name $name;
  67.         return $this;
  68.     }
  69.     public function getDescription(): ?string
  70.     {
  71.         return $this->description;
  72.     }
  73.     public function setDescription(?string $description): self
  74.     {
  75.         $this->description $description;
  76.         return $this;
  77.     }
  78.     public function getImage(): ?string
  79.     {
  80.         return $this->image;
  81.     }
  82.     public function setImage(?string $image): self
  83.     {
  84.         $this->image $image;
  85.         return $this;
  86.     }
  87.     public function getCreatedAt(): ?\DateTimeInterface
  88.     {
  89.         return $this->createdAt;
  90.     }
  91.     /**
  92.      * @ORM\PrePersist
  93.      */
  94.     public function setCreatedAt(): self
  95.     {
  96.         $this->createdAt = new \DateTime();
  97.         return $this;
  98.     }
  99.     public function getUpdatedAt(): ?\DateTimeInterface
  100.     {
  101.         return $this->updatedAt;
  102.     }
  103.     /**
  104.      * @ORM\PreUpdate
  105.      */
  106.     public function setUpdatedAt(): self
  107.     {
  108.         $this->updatedAt = new \DateTime();
  109.         return $this;
  110.     }
  111.     public function getType(): ?string
  112.     {
  113.         return $this->type;
  114.     }
  115.     public function setType(string $type): self
  116.     {
  117.         $this->type $type;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection<int, Transfers>
  122.      */
  123.     public function getTransfers(): Collection
  124.     {
  125.         return $this->transfers;
  126.     }
  127.     public function addTransfer(Transfers $transfer): self
  128.     {
  129.         if (!$this->transfers->contains($transfer)) {
  130.             $this->transfers[] = $transfer;
  131.             $transfer->setDestination($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeTransfer(Transfers $transfer): self
  136.     {
  137.         if ($this->transfers->removeElement($transfer)) {
  138.             // set the owning side to null (unless already changed)
  139.             if ($transfer->getDestination() === $this) {
  140.                 $transfer->setDestination(null);
  141.             }
  142.         }
  143.         return $this;
  144.     }
  145.     public function __toString()
  146.     {
  147.         return $this->name;
  148.     }
  149.     /**
  150.      * @return Collection<int, Car>
  151.      */
  152.     public function getCars(): Collection
  153.     {
  154.         return $this->cars;
  155.     }
  156.     public function addCar(Car $car): self
  157.     {
  158.         if (!$this->cars->contains($car)) {
  159.             $this->cars[] = $car;
  160.             $car->setDestination($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeCar(Car $car): self
  165.     {
  166.         if ($this->cars->removeElement($car)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($car->getDestination() === $this) {
  169.                 $car->setDestination(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174. }