<?php
namespace App\Entity;
use App\Repository\MotorcycleRepository;
use DateTimeInterface;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=MotorcycleRepository::class)
*/
class Motorcycle
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=30)
*/
private ?string $mark;
/**
* @ORM\Column(type="string", length=30)
*/
private ?string $model;
/**
* @ORM\Column(type="string", length=30)
*/
private ?string $vinNumber;
/**
* @ORM\Column(type="string", length=30)
*/
private ?string $registrationNumber;
/**
* @ORM\Column(type="datetime")
*/
private DateTimeInterface $issueYear;
/**
* @ORM\Column(type="float")
*/
private float $paymentAmount;
/**
* @ORM\OneToMany(targetEntity=Reserve::class, mappedBy="motorcycle")
*/
private Collection $reserves;
/**
* @ORM\Column(type="string", length=16, nullable=true)
*/
private $color;
public function __construct()
{
$this->reserves = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getMark(): ?string
{
return $this->mark;
}
public function setMark(string $mark): void
{
$this->mark = $mark;
}
public function getModel(): ?string
{
return $this->model;
}
public function setModel(string $model): self
{
$this->model = $model;
return $this;
}
public function getReserves(): Collection
{
return $this->reserves;
}
public function setReserves(Collection $reserves): void
{
$this->reserves = $reserves;
}
public function __toString(): string
{
return $this->getMark() . ' ' . $this->getModel();
}
public function getVinNumber(): ?string
{
return $this->vinNumber;
}
public function setVinNumber(?string $vinNumber): void
{
$this->vinNumber = $vinNumber;
}
public function getRegistrationNumber(): ?string
{
return $this->registrationNumber;
}
public function setRegistrationNumber(?string $registrationNumber): void
{
$this->registrationNumber = $registrationNumber;
}
public function getIssueYear(): ?DateTimeInterface
{
return $this->issueYear;
}
public function setIssueYear(DateTimeInterface $issueYear): void
{
$this->issueYear = $issueYear;
}
public function getPaymentAmount(): float
{
return $this->paymentAmount;
}
public function setPaymentAmount(float $paymentAmount): void
{
$this->paymentAmount = $paymentAmount;
}
public function getColor(): ?string
{
return $this->color ?? '#ff0000';
}
public function setColor(?string $color): self
{
$this->color = $color;
return $this;
}
public function getFullName(): string
{
return $this->getMark() . ' ' . $this->getModel();
}
}