<?php
/**
* Created by PhpStorm.
* User: apple
* Date: 29/03/19
* Time: 2:43 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
* @ORM\Table(name="wp_accessibility_country")
* @ORM\HasLifecycleCallbacks()
*/
class WP_Accessibility_Country implements JsonSerializable
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $original_name;
/**
* @ORM\Column(type="string", nullable=false)
* @Assert\NotBlank()
*/
private $country_code;
/**
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $active;
/**
* @ORM\Column(type="boolean", nullable=false)
* @Assert\NotBlank()
*/
private $search_state;
/**
* @ORM\Column(type="integer", nullable=false)
* @Assert\NotBlank()
*/
private $seq_number;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="WP_Accessibility_States", mappedBy="wp_accessibility_country")
*/
private $wp_accessibility_states;
/**
* One product has many features. This is the inverse side.
* @ORM\OneToMany(targetEntity="WP_Accessibility_Cities", mappedBy="wp_accessibility_country")
*/
private $wp_accessibility_cities;
/**
* @ORM\ManyToOne(targetEntity="WP_Currency")
* @ORM\JoinColumn(name="wp_currency_id", referencedColumnName="id")
*/
private $wp_currency;
/**
* @ORM\Column(type="integer", nullable=true)
* @Assert\NotBlank()
*/
private $web_country_id;
/**
* @ORM\Column(type="integer", nullable=true)
* @Assert\NotBlank()
*/
private $service_country_id;
/**
* @ORM\Column(type="integer", nullable=true)
* @Assert\NotBlank()
*/
private $state_count;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getOriginalName()
{
return $this->original_name;
}
/**
* @param mixed $original_name
*/
public function setOriginalName($original_name): void
{
$this->original_name = $original_name;
}
/**
* @return mixed
*/
public function getActive()
{
return $this->active;
}
/**
* @param mixed $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return mixed
*/
public function getSeqNumber()
{
return $this->seq_number;
}
/**
* @param mixed $seq_number
*/
public function setSeqNumber($seq_number)
{
$this->seq_number = $seq_number;
}
/**
* @return mixed
*/
public function getCountryCode()
{
return $this->country_code;
}
/**
* @param mixed $country_code
*/
public function setCountryCode($country_code)
{
$this->country_code = $country_code;
}
/**
* @return mixed
*/
public function getWpCurrency()
{
return $this->wp_currency;
}
/**
* @param mixed $wp_currency
*/
public function setWpCurrency($wp_currency)
{
$this->wp_currency = $wp_currency;
}
/**
* @return mixed
*/
public function getSearchState()
{
return $this->search_state;
}
/**
* @param mixed $search_state
*/
public function setSearchState($search_state)
{
$this->search_state = $search_state;
}
/**
* @return mixed
*/
public function getWpAccessibilityStates()
{
return $this->wp_accessibility_states;
}
/**
* @param mixed $wp_accessibility_states
*/
public function setWpAccessibilityStates($wp_accessibility_states)
{
$this->wp_accessibility_states = $wp_accessibility_states;
}
/**
* @return mixed
*/
public function getWpAccessibilityCities()
{
return $this->wp_accessibility_cities;
}
/**
* @param mixed $wp_accessibility_cities
*/
public function setWpAccessibilityCities($wp_accessibility_cities)
{
$this->wp_accessibility_cities = $wp_accessibility_cities;
}
/**
* @return mixed
*/
public function getWebCountryId()
{
return $this->web_country_id;
}
/**
* @param mixed $web_country_id
*/
public function setWebCountryId($web_country_id): void
{
$this->web_country_id = $web_country_id;
}
/**
* @return mixed
*/
public function getStateCount()
{
return $this->state_count;
}
/**
* @param mixed $state_count
*/
public function setStateCount($state_count): void
{
$this->state_count = $state_count;
}
/**
* @return mixed
*/
public function getServiceCountryId()
{
return $this->service_country_id;
}
/**
* @param mixed $service_country_id
*/
public function setServiceCountryId($service_country_id): void
{
$this->service_country_id = $service_country_id;
}
public function jsonSerialize()
{
return array(
'id' => $this->id,
'name' => $this->name,
'original_name' => $this->original_name,
'active' => $this->active,
'seq_number' => $this->seq_number,
'wp_currency' => $this->wp_currency,
'country_code' => $this->country_code,
'states' => ($this->getWpAccessibilityStates() != NULL && $this->search_state == true) ? $this->getWpAccessibilityStates()->toArray() : NULL,
'search_state' => $this->search_state,
'web_country_id' => $this->web_country_id,
'state_count' => $this->state_count,
'service_country_id' => $this->service_country_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->wp_accessibility_states = new ArrayCollection();
$this->wp_accessibility_cities = new ArrayCollection();
$this->setCreatedAt(round(microtime(true) * 1000));
}
}