<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 3:08 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(repositoryClass="App\AppBundle\MainBundle\Repository\PS_Add_Spot_Pricing_CustomRepository")
* @ORM\Table(name="ps_add_spot_pricing_custom")
* @ORM\HasLifecycleCallbacks()
*/
class PS_Add_Spot_Pricing_Custom implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="boolean", nullable=true)
* @Assert\NotBlank()
*/
private $is_default_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
* @Assert\NotBlank()
*/
private $default_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=true)
* @Assert\NotBlank()
*/
private $daily_max;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="PS_Add_Spot_Pricing_Custom_Price", mappedBy="ps_add_spot_pricing_custom")
*/
private $ps_add_spot_pricing_custom_prices;
/**
* @var PS_Add_Spot_Availability
* @ORM\OneToOne(targetEntity="PS_Add_Spot_Availability")
* @ORM\JoinColumn(name="ps_add_spot_availability_id", referencedColumnName="id")
*/
private $ps_add_spot_availability;
/**
* Many features have one product. This is the owning side.
* @ORM\ManyToOne(targetEntity="PS_Add_Spot_Pricing", inversedBy="ps_add_spot_pricing_custom")
* @ORM\JoinColumn(name="ps_add_spot_pricing_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $ps_add_spot_pricing;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getDefaultRate()
{
return $this->default_rate;
}
/**
* @param mixed $default_rate
*/
public function setDefaultRate($default_rate)
{
$this->default_rate = $default_rate;
}
/**
* @return mixed
*/
public function getDailyMax()
{
return $this->daily_max;
}
/**
* @param mixed $daily_max
*/
public function setDailyMax($daily_max)
{
$this->daily_max = $daily_max;
}
/**
* Add subscriptionPlan
*
* @param PS_Add_Spot_Pricing_Custom_Price $customPrice
*
* @return PS_Add_Spot_Pricing_Custom
*/
public function addPsAddSpotPricingCustomPrices(PS_Add_Spot_Pricing_Custom_Price $customPrice) {
if (!$this->ps_add_spot_pricing_custom_prices->contains($customPrice)) {
$this->ps_add_spot_pricing_custom_prices->add($customPrice);
$customPrice->setPsAddSpotPricingCustom($this);
}
return $this;
}
/**
* Remove PS_Add_Spot_Pricing_Custom_Price
*
* @param PS_Add_Spot_Pricing_Custom_Price $customPrice
*/
public function removePsAddSpotPricingCustomPrices(PS_Add_Spot_Pricing_Custom_Price $customPrice) {
$this->ps_add_spot_pricing_custom_prices->removeElement($customPrice);
}
/**
* @return \Doctrine\Common\Collections\Collection
*/
public function getPsAddSpotPricingCustomPrices()
{
return $this->ps_add_spot_pricing_custom_prices;
}
// /**
// * @param mixed $ps_add_spot_pricing_custom_prices
// */
// public function setPsAddSpotPricingCustomPrices($ps_add_spot_pricing_custom_prices)
// {
// $this->ps_add_spot_pricing_custom_prices = $ps_add_spot_pricing_custom_prices;
// }
/**
* @return PS_Add_Spot_Availability
*/
public function getPsAddSpotAvailability()
{
return $this->ps_add_spot_availability;
}
/**
* @param mixed $ps_add_spot_availability
*/
public function setPsAddSpotAvailability($ps_add_spot_availability)
{
$this->ps_add_spot_availability = $ps_add_spot_availability;
}
/**
* @return mixed
*/
public function getIsDefaultRate()
{
return $this->is_default_rate;
}
/**
* @param mixed $is_default_rate
*/
public function setIsDefaultRate($is_default_rate)
{
$this->is_default_rate = $is_default_rate;
}
/**
* @return mixed
*/
public function getPsAddSpotPricing()
{
return $this->ps_add_spot_pricing;
}
/**
* @param mixed $ps_add_spot_pricing
*/
public function setPsAddSpotPricing($ps_add_spot_pricing)
{
$this->ps_add_spot_pricing = $ps_add_spot_pricing;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
);
}
/**
* @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->ps_add_spot_pricing_custom_prices = new ArrayCollection();
$this->setCreatedAt(round(microtime(true) * 1000));
}
}