<?php
namespace App\AppBundle\MainBundle\Entity;
use DateTime;
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="orders_flexible")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Flexible implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var Orders
* @ORM\ManyToOne(targetEntity="Orders", inversedBy="ordersFlexible")
* @ORM\JoinColumn(name="order_id", referencedColumnName="id")
*/
private $order;
/**
* @var PS_Add_Spot
* @ORM\ManyToOne(targetEntity="PS_Add_Spot")
* @ORM\JoinColumn(name="add_spot_id", referencedColumnName="id")
*/
private $add_spot;
/**
* @var DateTime
* @ORM\Column(type="date", nullable=false)
* @Assert\NotBlank()
*/
private $start_date;
/**
* @var DateTime
* @ORM\Column(type="date", nullable=false)
* @Assert\NotBlank()
*/
private $end_date;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return Orders
*/
public function getOrder()
{
return $this->order;
}
/**
* @param mixed $order
*/
public function setOrder($order)
{
$this->order = $order;
}
/**
* @return PS_Add_Spot
*/
public function getAddSpot()
{
return $this->add_spot;
}
/**
* @param mixed $add_spot
*/
public function setAddSpot($add_spot)
{
$this->add_spot = $add_spot;
}
/**
* @return DateTime
*/
public function getStartDate()
{
return $this->start_date;
}
/**
* @param mixed $start_date
*/
public function setStartDate($start_date)
{
$this->start_date = $start_date;
}
/**
* @return DateTime
*/
public function getEndDate()
{
return $this->end_date;
}
/**
* @param mixed $end_date
*/
public function setEndDate($end_date)
{
$this->end_date = $end_date;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'start_date' => $this->start_date->format('Y-m-d H:i:s'),
'end_date' => $this->end_date->format('Y-m-d H:i:s'),
);
}
/**
* @var DateTime $created
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var DateTime $updated
*
* @ORM\Column(type="datetime", nullable=false)
*/
protected $updatedAt;
/**
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* @return DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* @ORM\PrePersist
*/
public function setCreatedAt()
{
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
return $this;
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue() {
$this->updatedAt = new DateTime();
}
public function __construct() {
}
}