<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 3:08 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="ps_add_spot_pricing_custom_price")
* @ORM\HasLifecycleCallbacks()
*/
class PS_Add_Spot_Pricing_Custom_Price implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="time", nullable=true)
* @Assert\NotBlank()
*/
private $start_time;
/**
* @ORM\Column(type="time", nullable=true)
* @Assert\NotBlank()
*/
private $end_time;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
* @Assert\NotBlank()
*/
private $hourly_rate;
/**
* Many features have one product. This is the owning side.
* @ORM\ManyToOne(targetEntity="PS_Add_Spot_Pricing_Custom", inversedBy="ps_add_spot_pricing_custom_prices")
* @ORM\JoinColumn(name="ps_add_spot_pricing_custom_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $ps_add_spot_pricing_custom;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return \DateTime
*/
public function getStartTime()
{
return $this->start_time;
}
/**
* @param mixed $start_time
*/
public function setStartTime($start_time)
{
$this->start_time = $start_time;
}
/**
* @return \DateTime
*/
public function getEndTime()
{
return $this->end_time;
}
/**
* @param mixed $end_time
*/
public function setEndTime($end_time)
{
$this->end_time = $end_time;
}
/**
* @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 getPsAddSpotPricingCustom()
{
return $this->ps_add_spot_pricing_custom;
}
/**
* @param mixed $ps_add_spot_pricing_custom
*/
public function setPsAddSpotPricingCustom($ps_add_spot_pricing_custom)
{
$this->ps_add_spot_pricing_custom = $ps_add_spot_pricing_custom;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'hourly_rate' => $this->hourly_rate,
'start_time' => $this->start_time,
'end_time' => $this->end_time,
);
}
/**
* @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));
}
}