<?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="orders_custom_pricing")
* @ORM\HasLifecycleCallbacks()
*/
class Orders_Custom_Pricing implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
* @Assert\NotBlank()
*/
private $hourly_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
* @Assert\NotBlank()
*/
private $daily_max;
/**
* @ORM\Column(type="decimal", precision=10, scale=2)
* @Assert\NotBlank()
*/
private $sub_custom_price;
/**
* @ORM\Column(type="time", nullable=false)
* @Assert\NotBlank()
*/
private $start_time;
/**
* @ORM\Column(type="time", nullable=false)
* @Assert\NotBlank()
*/
private $end_time;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getHourlyRate()
{
return $this->hourly_rate;
}
/**
* @param mixed $hourly_rate
*/
public function setHourlyRate($hourly_rate)
{
$this->hourly_rate = $hourly_rate;
}
/**
* @return mixed
*/
public function getDailyMax()
{
return $this->daily_max;
}
/**
* @param mixed $daily_max
*/
public function setDailyMax($daily_max)
{
$this->daily_max = $daily_max;
}
/**
* @return mixed
*/
public function getSubCustomPrice()
{
return $this->sub_custom_price;
}
/**
* @param mixed $sub_custom_price
*/
public function setSubCustomPrice($sub_custom_price)
{
$this->sub_custom_price = $sub_custom_price;
}
/**
* @return mixed
*/
public function getStartTime()
{
return $this->start_time;
}
/**
* @param mixed $start_time
*/
public function setStartTime($start_time)
{
$this->start_time = $start_time;
}
/**
* @return mixed
*/
public function getEndTime()
{
return $this->end_time;
}
/**
* @param mixed $end_time
*/
public function setEndTime($end_time)
{
$this->end_time = $end_time;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'end_time' => $this->end_time != NULL ? $this->end_time->format('H:i:s') : "",
'start_time' => $this->start_time != NULL ? $this->start_time->format('H:i:s') : "",
'daily_max' => $this->daily_max,
'hourly_rate' => $this->hourly_rate,
'sub_custom_price' => $this->sub_custom_price,
);
}
/**
* @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));
}
}