<?php
/**
* Created by PhpStorm.
* User: parcel
* Date: 9/20/18
* Time: 4:32 PM
*/
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Entity(repositoryClass="App\Repository\VehicleRepository")
* @ORM\Table(name="vehicle", uniqueConstraints={@ORM\UniqueConstraint(name="reg_number", columns={"reg_number"})} )
*/
class Vehicle {
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="IDENTITY")
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=8)
*/
private $regNumber;
/**
* @ORM\Column(type="integer")
*/
private $passengerCapacity;
/**
* @ORM\Column(type="string", length=15)
*/
private $vehicleName;
/**
* @ORM\Column(type="integer")
*/
private $manufactureYear;
/**
* @ORM\Column(type="string", length=10)
*/
private $fuel;
/**
* @var \App\Entity\Model
* @Serializer\Type("App\Entity\Model")
* @ORM\ManyToOne(targetEntity="App\Entity\Model")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="model_id", referencedColumnName="id")
* })
*/
private $model;
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
/**
* @var \App\Entity\User
* @Serializer\Type("App\Entity\User")
* @ORM\ManyToOne(targetEntity="App\Entity\User")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="created_by", referencedColumnName="id")
* })
*/
private $createdBy;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return mixed
*/
public function getRegNumber()
{
return $this->regNumber;
}
/**
* @param mixed $regNumber
*/
public function setRegNumber($regNumber)
{
$this->regNumber = $regNumber;
}
/**
* @return mixed
*/
public function getPassengerCapacity()
{
return $this->passengerCapacity;
}
/**
* @param mixed $passengerCapacity
*/
public function setPassengerCapacity($passengerCapacity)
{
$this->passengerCapacity = $passengerCapacity;
}
/**
* @return mixed
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @param mixed $createdAt
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
}
/**
* @return User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @param User $createdBy
*/
public function setCreatedBy($createdBy)
{
$this->createdBy = $createdBy;
}
/**
* @return mixed
*/
public function getVehicleName()
{
return $this->vehicleName;
}
/**
* @param mixed $vehicleName
*/
public function setVehicleName($vehicleName)
{
$this->vehicleName = $vehicleName;
}
/**
* @return mixed
*/
public function getManufactureYear()
{
return $this->manufactureYear;
}
/**
* @param mixed $manufactureYear
*/
public function setManufactureYear($manufactureYear)
{
$this->manufactureYear = $manufactureYear;
}
/**
* @return mixed
*/
public function getFuel()
{
return $this->fuel;
}
/**
* @param mixed $fuel
*/
public function setFuel($fuel)
{
$this->fuel = $fuel;
}
/**
* @return Model
*/
public function getModel()
{
return $this->model;
}
/**
* @param Model $model
*/
public function setModel($model)
{
$this->model = $model;
}
public function __toString()
{
// TODO: Implement __toString() method.
return $this->getRegNumber()."[ {$this->getPassengerCapacity()} ]";
}
}