src/Entity/Motorcycle.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\RentalPrice;
  4. use App\Repository\MotorcycleRepository;
  5. use DateTimeInterface;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=MotorcycleRepository::class)
  11.  */
  12. class Motorcycle
  13. {
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=30)
  22.      */
  23.     private ?string $mark;
  24.     /**
  25.      * @ORM\Column(type="string", length=30)
  26.      */
  27.     private ?string $model;
  28.     /**
  29.      * @ORM\Column(type="string", length=30)
  30.      */
  31.     private ?string $vinNumber;
  32.     /**
  33.      * @ORM\Column(type="string", length=30)
  34.      */
  35.     private ?string $registrationNumber;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private DateTimeInterface $issueYear;
  40.     /**
  41.      * @ORM\Column(type="float")
  42.      */
  43.     private float $paymentAmount;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=Reserve::class, mappedBy="motorcycle")
  46.      */
  47.     private Collection $reserves;
  48.     /**
  49.      * @ORM\OneToMany(targetEntity=ServiceHistory::class, mappedBy="motorcycle")
  50.      */
  51.     private Collection $services;
  52.     /**
  53.      * @ORM\Column(type="string", length=16, nullable=true)
  54.      */
  55.     private $color;
  56.     /**
  57.      * @ORM\Column(type="integer", nullable=true)
  58.      */
  59.     private ?int $mileage;
  60.     /**
  61.      * Rental price profile (different prices for 1h, 6h, 24h, week, month etc.)
  62.      * One price profile can be shared across multiple motorcycles.
  63.      *
  64.      * @ORM\ManyToOne(targetEntity=RentalPrice::class, inversedBy="motorcycles")
  65.      * @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
  66.      */
  67.     private ?RentalPrice $rentalPrice null;
  68.     public function __construct()
  69.     {
  70.         $this->reserves = new ArrayCollection();
  71.         $this->services = new ArrayCollection();
  72.     }
  73.     public function getId(): ?int
  74.     {
  75.         return $this->id;
  76.     }
  77.     public function getMark(): ?string
  78.     {
  79.         return $this->mark;
  80.     }
  81.     public function setMark(string $mark): void
  82.     {
  83.         $this->mark $mark;
  84.     }
  85.     public function getModel(): ?string
  86.     {
  87.         return $this->model;
  88.     }
  89.     public function setModel(string $model): self
  90.     {
  91.         $this->model $model;
  92.         return $this;
  93.     }
  94.     public function getReserves(): Collection
  95.     {
  96.         return $this->reserves;
  97.     }
  98.     public function setReserves(Collection $reserves): void
  99.     {
  100.         $this->reserves $reserves;
  101.     }
  102.     public function __toString(): string
  103.     {
  104.         return $this->getMark() . ' ' $this->getModel();
  105.     }
  106.     public function getVinNumber(): ?string
  107.     {
  108.         return $this->vinNumber;
  109.     }
  110.     public function setVinNumber(?string $vinNumber): void
  111.     {
  112.         $this->vinNumber $vinNumber;
  113.     }
  114.     public function getRegistrationNumber(): ?string
  115.     {
  116.         return $this->registrationNumber;
  117.     }
  118.     public function setRegistrationNumber(?string $registrationNumber): void
  119.     {
  120.         $this->registrationNumber $registrationNumber;
  121.     }
  122.     public function getIssueYear(): ?DateTimeInterface
  123.     {
  124.         return $this->issueYear;
  125.     }
  126.     public function setIssueYear(DateTimeInterface $issueYear): void
  127.     {
  128.         $this->issueYear $issueYear;
  129.     }
  130.     public function getPaymentAmount(): float
  131.     {
  132.         return $this->paymentAmount;
  133.     }
  134.     public function setPaymentAmount(float $paymentAmount): void
  135.     {
  136.         $this->paymentAmount $paymentAmount;
  137.     }
  138.     public function getColor(): ?string
  139.     {
  140.         return $this->color ?? '#ff0000';
  141.     }
  142.     public function setColor(?string $color): self
  143.     {
  144.         $this->color $color;
  145.         return $this;
  146.     }
  147.     public function getFullName(): string
  148.     {
  149.         return $this->getMark() . ' ' $this->getModel();
  150.     }
  151.     public function getMileage(): ?int
  152.     {
  153.         return $this->mileage;
  154.     }
  155.     public function setMileage(?int $mileage): void
  156.     {
  157.         $this->mileage $mileage;
  158.     }
  159.     public function getServices(): Collection
  160.     {
  161.         return $this->services;
  162.     }
  163.     public function setServices(Collection $services): void
  164.     {
  165.         $this->services $services;
  166.     }
  167.     public function getRentalPrice(): ?RentalPrice
  168.     {
  169.         return $this->rentalPrice;
  170.     }
  171.     public function setRentalPrice(?RentalPrice $rentalPrice): self
  172.     {
  173.         $this->rentalPrice $rentalPrice;
  174.         return $this;
  175.     }
  176. }