src/AppBundle/MainBundle/Entity/WP_Accessibility_Country.php line 335

Open in your IDE?
  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: apple
  5.  * Date: 29/03/19
  6.  * Time: 2:43 PM
  7.  */
  8. namespace App\AppBundle\MainBundle\Entity;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Validator\Constraints as Assert;
  12. use JsonSerializable;
  13. /**
  14.  * AddOns
  15.  *
  16.  * @ORM\Entity
  17.  * @ORM\Table(name="wp_accessibility_country")
  18.  * @ORM\HasLifecycleCallbacks()
  19.  */
  20. class WP_Accessibility_Country  implements JsonSerializable
  21. {
  22.     /**
  23.      * @ORM\Column(type="integer")
  24.      * @ORM\Id
  25.      * @ORM\GeneratedValue(strategy="AUTO")
  26.      */
  27.     private $id;
  28.     /**
  29.      * @ORM\Column(type="string", nullable=false)
  30.      * @Assert\NotBlank()
  31.      */
  32.     private $name;
  33.     /**
  34.      * @ORM\Column(type="string", nullable=false)
  35.      * @Assert\NotBlank()
  36.      */
  37.     private $original_name;
  38.     /**
  39.      * @ORM\Column(type="string", nullable=false)
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $country_code;
  43.     /**
  44.      * @ORM\Column(type="boolean", nullable=false)
  45.      * @Assert\NotBlank()
  46.      */
  47.     private $active;
  48.     /**
  49.      * @ORM\Column(type="boolean", nullable=false)
  50.      * @Assert\NotBlank()
  51.      */
  52.     private $search_state;
  53.     /**
  54.      * @ORM\Column(type="integer", nullable=false)
  55.      * @Assert\NotBlank()
  56.      */
  57.     private $seq_number;
  58.     /**
  59.      * One product has many features. This is the inverse side.
  60.      * @ORM\OneToMany(targetEntity="WP_Accessibility_States", mappedBy="wp_accessibility_country")
  61.      */
  62.     private $wp_accessibility_states;
  63.     /**
  64.      * One product has many features. This is the inverse side.
  65.      * @ORM\OneToMany(targetEntity="WP_Accessibility_Cities", mappedBy="wp_accessibility_country")
  66.      */
  67.     private $wp_accessibility_cities;
  68.     /**
  69.      * @ORM\ManyToOne(targetEntity="WP_Currency")
  70.      * @ORM\JoinColumn(name="wp_currency_id", referencedColumnName="id")
  71.      */
  72.     private $wp_currency;
  73.     /**
  74.      * @ORM\Column(type="integer", nullable=true)
  75.      * @Assert\NotBlank()
  76.      */
  77.     private $web_country_id;
  78.     /**
  79.      * @ORM\Column(type="integer", nullable=true)
  80.      * @Assert\NotBlank()
  81.      */
  82.     private $service_country_id;
  83.     /**
  84.      * @ORM\Column(type="integer", nullable=true)
  85.      * @Assert\NotBlank()
  86.      */
  87.     private $state_count;
  88.     /**
  89.      * @return mixed
  90.      */
  91.     public function getId()
  92.     {
  93.         return $this->id;
  94.     }
  95.     /**
  96.      * @return mixed
  97.      */
  98.     public function getName()
  99.     {
  100.         return $this->name;
  101.     }
  102.     /**
  103.      * @param mixed $name
  104.      */
  105.     public function setName($name)
  106.     {
  107.         $this->name $name;
  108.     }
  109.     /**
  110.      * @return mixed
  111.      */
  112.     public function getOriginalName()
  113.     {
  114.         return $this->original_name;
  115.     }
  116.     /**
  117.      * @param mixed $original_name
  118.      */
  119.     public function setOriginalName($original_name): void
  120.     {
  121.         $this->original_name $original_name;
  122.     }
  123.     /**
  124.      * @return mixed
  125.      */
  126.     public function getActive()
  127.     {
  128.         return $this->active;
  129.     }
  130.     /**
  131.      * @param mixed $active
  132.      */
  133.     public function setActive($active)
  134.     {
  135.         $this->active $active;
  136.     }
  137.     /**
  138.      * @return mixed
  139.      */
  140.     public function getSeqNumber()
  141.     {
  142.         return $this->seq_number;
  143.     }
  144.     /**
  145.      * @param mixed $seq_number
  146.      */
  147.     public function setSeqNumber($seq_number)
  148.     {
  149.         $this->seq_number $seq_number;
  150.     }
  151.     /**
  152.      * @return mixed
  153.      */
  154.     public function getCountryCode()
  155.     {
  156.         return $this->country_code;
  157.     }
  158.     /**
  159.      * @param mixed $country_code
  160.      */
  161.     public function setCountryCode($country_code)
  162.     {
  163.         $this->country_code $country_code;
  164.     }
  165.     /**
  166.      * @return mixed
  167.      */
  168.     public function getWpCurrency()
  169.     {
  170.         return $this->wp_currency;
  171.     }
  172.     /**
  173.      * @param mixed $wp_currency
  174.      */
  175.     public function setWpCurrency($wp_currency)
  176.     {
  177.         $this->wp_currency $wp_currency;
  178.     }
  179.     /**
  180.      * @return mixed
  181.      */
  182.     public function getSearchState()
  183.     {
  184.         return $this->search_state;
  185.     }
  186.     /**
  187.      * @param mixed $search_state
  188.      */
  189.     public function setSearchState($search_state)
  190.     {
  191.         $this->search_state $search_state;
  192.     }
  193.     /**
  194.      * @return mixed
  195.      */
  196.     public function getWpAccessibilityStates()
  197.     {
  198.         return $this->wp_accessibility_states;
  199.     }
  200.     /**
  201.      * @param mixed $wp_accessibility_states
  202.      */
  203.     public function setWpAccessibilityStates($wp_accessibility_states)
  204.     {
  205.         $this->wp_accessibility_states $wp_accessibility_states;
  206.     }
  207.     /**
  208.      * @return mixed
  209.      */
  210.     public function getWpAccessibilityCities()
  211.     {
  212.         return $this->wp_accessibility_cities;
  213.     }
  214.     /**
  215.      * @param mixed $wp_accessibility_cities
  216.      */
  217.     public function setWpAccessibilityCities($wp_accessibility_cities)
  218.     {
  219.         $this->wp_accessibility_cities $wp_accessibility_cities;
  220.     }
  221.     /**
  222.      * @return mixed
  223.      */
  224.     public function getWebCountryId()
  225.     {
  226.         return $this->web_country_id;
  227.     }
  228.     /**
  229.      * @param mixed $web_country_id
  230.      */
  231.     public function setWebCountryId($web_country_id): void
  232.     {
  233.         $this->web_country_id $web_country_id;
  234.     }
  235.     /**
  236.      * @return mixed
  237.      */
  238.     public function getStateCount()
  239.     {
  240.         return $this->state_count;
  241.     }
  242.     /**
  243.      * @param mixed $state_count
  244.      */
  245.     public function setStateCount($state_count): void
  246.     {
  247.         $this->state_count $state_count;
  248.     }
  249.     /**
  250.      * @return mixed
  251.      */
  252.     public function getServiceCountryId()
  253.     {
  254.         return $this->service_country_id;
  255.     }
  256.     /**
  257.      * @param mixed $service_country_id
  258.      */
  259.     public function setServiceCountryId($service_country_id): void
  260.     {
  261.         $this->service_country_id $service_country_id;
  262.     }
  263.     public function jsonSerialize()
  264.     {
  265.         return array(
  266.             'id' => $this->id,
  267.             'name' => $this->name,
  268.             'original_name' => $this->original_name,
  269.             'active' => $this->active,
  270.             'seq_number' => $this->seq_number,
  271.             'wp_currency' => $this->wp_currency,
  272.             'country_code' => $this->country_code,
  273.             'states' => ($this->getWpAccessibilityStates() != NULL && $this->search_state == true) ? $this->getWpAccessibilityStates()->toArray() : NULL,
  274.             'search_state' => $this->search_state,
  275.             'web_country_id' => $this->web_country_id,
  276.             'state_count' => $this->state_count,
  277.             'service_country_id' => $this->service_country_id
  278.         );
  279.     }
  280.     /**
  281.      * @var string $created
  282.      *
  283.      * @ORM\Column(name="created_at", type="string", nullable=false)
  284.      */
  285.     protected $createdAt;
  286.     /**
  287.      * @var string $updated
  288.      *
  289.      * @ORM\Column(name="updated_at", type="string", nullable=false)
  290.      */
  291.     protected $updatedAt;
  292.     public function getCreatedAt()
  293.     {
  294.         return $this->createdAt;
  295.     }
  296.     public function setCreatedAt($createdAt)
  297.     {
  298.         $this->createdAt $createdAt;
  299.         return $this;
  300.     }
  301.     public function getUpdatedAt()
  302.     {
  303.         return $this->updatedAt;
  304.     }
  305.     public function setUpdatedAt($updatedAt)
  306.     {
  307.         $this->updatedAt $updatedAt;
  308.         return $this;
  309.     }
  310.     /**
  311.      * @ORM\PrePersist
  312.      * @ORM\PreUpdate
  313.      */
  314.     public function updatedTimestamps()
  315.     {
  316.         $this->setUpdatedAt(round(microtime(true) * 1000));
  317.         if ($this->getCreatedAt() === null) {
  318.             $this->setCreatedAt(round(microtime(true) * 1000));
  319.         }
  320.     }
  321.     public function __construct() {
  322.         $this->wp_accessibility_states = new ArrayCollection();
  323.         $this->wp_accessibility_cities = new ArrayCollection();
  324.         $this->setCreatedAt(round(microtime(true) * 1000));
  325.     }
  326. }