<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 2:41 PM
*/
namespace App\AppBundle\MainBundle\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="wp_max_vehicle_size")
* @ORM\HasLifecycleCallbacks()
*/
class WP_Max_Vehicle_Size implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="WP_Max_Vehicle_Size_Type", mappedBy="max_vehicle_size")
*/
private $max_vehicle_size_types;
/**
* @ORM\Column(type="string", nullable=false)
*/
private $name;
/**
* @ORM\Column(type="boolean", nullable=false)
*/
private $active = true;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private $type;
/**
* @ORM\Column(type="integer", nullable=false)
*/
private $seq_number;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getActive()
{
return $this->active;
}
/**
* @param mixed $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getType()
{
return $this->type;
}
/**
* @param mixed $type
*/
public function setType($type)
{
$this->type = $type;
}
/**
* @return mixed
*/
public function getSeqNumber()
{
return $this->seq_number;
}
/**
* @param mixed $seq_number
*/
public function setSeqNumber($seq_number)
{
$this->seq_number = $seq_number;
}
/**
* @return mixed
*/
public function getMaxVehicleSizeTypes()
{
return $this->max_vehicle_size_types;
}
/**
* @param mixed $max_vehicle_size_types
*/
public function setMaxVehicleSizeTypes($max_vehicle_size_types)
{
$this->max_vehicle_size_types = $max_vehicle_size_types;
}
/**
* @param WP_Max_Vehicle_Size_Type $max_vehicle_size_type
* @return WP_Max_Vehicle_Size
*/
public function addMaxVehicleSizeType(WP_Max_Vehicle_Size_Type $max_vehicle_size_type) {
if (!$this->max_vehicle_size_types->contains($max_vehicle_size_type)) {
$this->max_vehicle_size_types->add($max_vehicle_size_type);
}
return $this;
}
/**
* @param WP_Max_Vehicle_Size_Type $max_vehicle_size_type
*/
public function removeMaxVehicleSizeType(WP_Max_Vehicle_Size_Type $max_vehicle_size_type) {
$this->max_vehicle_size_types->removeElement($max_vehicle_size_type);
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'seq_number' => $this->seq_number,
'active' => $this->active,
'name' => $this->name,
'type' => $this->type,
'max_vehicle_size_types' => $this->getMaxVehicleSizeTypes()
);
}
/**
* @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));
$this->max_vehicle_size_types = new ArrayCollection();
}
}