<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 3:06 PM
*/
namespace App\AppBundle\MainBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="pu_vehicles")
* @ORM\HasLifecycleCallbacks()
*/
class PU_Vehicles implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $user_id;
/**
* Many Token have one user. This is the owning side.
* @ORM\ManyToOne(targetEntity="User", inversedBy="vehicles")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/
private $user;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $license_plate;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $model;
/**
* @ORM\Column(type="string", nullable=true)
*/
private $color = "";
/**
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $is_default;
/**
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $is_active;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUserId()
{
return $this->user_id;
}
/**
* @param mixed $user_id
*/
public function setUserId($user_id)
{
$this->user_id = $user_id;
}
/**
* @return mixed
*/
public function getLicensePlate()
{
return $this->license_plate;
}
/**
* @param mixed $license_plate
*/
public function setLicensePlate($license_plate)
{
$this->license_plate = $license_plate;
}
/**
* @return mixed
*/
public function getModel()
{
return $this->model;
}
/**
* @param mixed $model
*/
public function setModel($model)
{
$this->model = $model;
}
/**
* @return mixed
*/
public function getisDefault()
{
return $this->is_default;
}
/**
* @param mixed $is_default
*/
public function setIsDefault($is_default)
{
$this->is_default = $is_default;
}
/**
* @return mixed
*/
public function getisActive()
{
return $this->is_active;
}
/**
* @param mixed $is_active
*/
public function setIsActive($is_active)
{
$this->is_active = $is_active;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return mixed
*/
public function getColor()
{
return $this->color;
}
/**
* @param mixed $color
*/
public function setColor($color)
{
$this->color = $color;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'license_plate' => $this->license_plate,
'model' => $this->model,
'color' => $this->color,
'is_default' => $this->is_default,
'is_active' => $this->is_active,
);
}
/**
* @var string $created
*
* @ORM\Column(name="created_at", type="string", nullable=false)
*/
protected $createdAt;
/**
* @var string $updated
*
* @ORM\Column(name="updated_at", type="string", nullable=false)
*/
protected $updatedAt;
public function getCreatedAt()
{
return $this->createdAt;
}
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
* @ORM\PreUpdate
*/
public function updatedTimestamps()
{
$this->setUpdatedAt(round(microtime(true) * 1000));
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}
public function __construct() {
$this->setCreatedAt(round(microtime(true) * 1000));
}
}