<?php
namespace App\AppBundle\MainBundle\Entity;
use App\AppBundle\AdminBundle\Entity\Admin_User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use JsonSerializable;
/**
* AddOns
*
* @ORM\Entity
* @ORM\Table(name="wp_pricing_data")
* @ORM\HasLifecycleCallbacks()
*/
class WP_Pricing_Data implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=1024, nullable=false)
* @Assert\NotBlank()
*/
private $area_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $zip_code;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=false)
* @Assert\NotBlank()
*/
private $min_hourly_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=false)
* @Assert\NotBlank()
*/
private $max_hourly_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=false)
* @Assert\NotBlank()
*/
private $min_monthly_rate;
/**
* @ORM\Column(type="decimal", precision=10, scale=2, nullable=false)
* @Assert\NotBlank()
*/
private $max_monthly_rate;
/**
* @ORM\ManyToOne(targetEntity="WP_Currency")
* @ORM\JoinColumn(name="wp_currency_id", referencedColumnName="id")
*/
private $wp_currency;
/**
* @var Admin_User
* @ORM\ManyToOne(targetEntity="App\AppBundle\AdminBundle\Entity\Admin_User")
* @ORM\JoinColumn(name="created_by_admin_user_id", referencedColumnName="id")
*/
private $createdBy;
/**
* @var Admin_User
* @ORM\ManyToOne(targetEntity="App\AppBundle\AdminBundle\Entity\Admin_User")
* @ORM\JoinColumn(name="updated_by_admin_user_id", referencedColumnName="id")
*/
private $updatedBy;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getAreaName()
{
return $this->area_name;
}
/**
* @param mixed $area_name
*/
public function setAreaName($area_name)
{
$this->area_name = $area_name;
}
/**
* @return mixed
*/
public function getZipCode()
{
return $this->zip_code;
}
/**
* @param mixed $zip_code
*/
public function setZipCode($zip_code)
{
$this->zip_code = $zip_code;
}
/**
* @return mixed
*/
public function getMinHourlyRate()
{
return $this->min_hourly_rate;
}
/**
* @param mixed $min_hourly_rate
*/
public function setMinHourlyRate($min_hourly_rate)
{
$this->min_hourly_rate = $min_hourly_rate;
}
/**
* @return mixed
*/
public function getMaxHourlyRate()
{
return $this->max_hourly_rate;
}
/**
* @param mixed $max_hourly_rate
*/
public function setMaxHourlyRate($max_hourly_rate)
{
$this->max_hourly_rate = $max_hourly_rate;
}
/**
* @return mixed
*/
public function getMinMonthlyRate()
{
return $this->min_monthly_rate;
}
/**
* @param mixed $min_monthly_rate
*/
public function setMinMonthlyRate($min_monthly_rate)
{
$this->min_monthly_rate = $min_monthly_rate;
}
/**
* @return mixed
*/
public function getMaxMonthlyRate()
{
return $this->max_monthly_rate;
}
/**
* @param mixed $max_monthly_rate
*/
public function setMaxMonthlyRate($max_monthly_rate)
{
$this->max_monthly_rate = $max_monthly_rate;
}
/**
* @return WP_Currency
*/
public function getWpCurrency()
{
return $this->wp_currency;
}
/**
* @param WP_Currency $wp_currency
*/
public function setWpCurrency($wp_currency)
{
$this->wp_currency = $wp_currency;
}
/**
* @return Admin_User
*/
public function getCreatedBy()
{
return $this->createdBy;
}
/**
* @param Admin_User $createdBy
*/
public function setCreatedBy(Admin_User $createdBy)
{
$this->createdBy = $createdBy;
}
/**
* @return Admin_User
*/
public function getUpdatedBy()
{
return $this->updatedBy;
}
/**
* @param Admin_User $updatedBy
*/
public function setUpdatedBy(Admin_User $updatedBy)
{
$this->updatedBy = $updatedBy;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'area_name' => $this->area_name,
'zip_code' => $this->zip_code,
'min_hourly_rate' => $this->min_hourly_rate,
'max_hourly_rate' => $this->max_hourly_rate,
'min_monthly_rate' => $this->min_monthly_rate,
'max_monthly_rate' => $this->max_monthly_rate,
'currency' => $this->getWpCurrency()->getSymbol(),
'currency_id' => $this->getWpCurrency()->getId(),
'created_by_id' => $this->createdBy->getId(),
'updated_by_id' => $this->updatedBy->getId(),
'created_by_name' => $this->createdBy->getFirstName().' '.$this->createdBy->getLastName(),
'updated_by_name' => $this->updatedBy->getFirstName().' '.$this->updatedBy->getLastName(),
'created' => $this->createdAt->format('Y-m-d H:i:s'),
'updated' => $this->updatedAt->format('Y-m-d H:i:s'),
);
}
/**
* @var \DateTime $created
*
* @ORM\Column(name="created_at", type="datetime", nullable=false)
*/
protected $createdAt;
/**
* @var \DateTime $updated
*
* @ORM\Column(name="updated_at", type="datetime", 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(new \DateTime());
if ($this->getCreatedAt() === null) {
$this->setCreatedAt(new \DateTime());
}
}
public function __construct() {
$this->setCreatedAt(new \DateTime());
}
}