src/AppBundle/MainBundle/Entity/WP_Accessibility_States.php line 292

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_states")
  18.  * @ORM\HasLifecycleCallbacks()
  19.  */
  20. class WP_Accessibility_States  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=true)
  40.      * @Assert\NotBlank()
  41.      */
  42.     private $state_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_city;
  53.     /**
  54.      * Many features have one product. This is the owning side.
  55.      * @ORM\ManyToOne(targetEntity="WP_Accessibility_Country", inversedBy="wp_accessibility_states")
  56.      * @ORM\JoinColumn(name="wp_accessibility_country_id", referencedColumnName="id")
  57.      */
  58.     private $wp_accessibility_country;
  59.     /**
  60.      * One product has many features. This is the inverse side.
  61.      * @ORM\OneToMany(targetEntity="WP_Accessibility_Cities", mappedBy="wp_accessibility_states")
  62.      */
  63.     private $wp_accessibility_cities;
  64.     /**
  65.      * @ORM\Column(type="integer", nullable=true)
  66.      * @Assert\NotBlank()
  67.      */
  68.     private $web_state_id;
  69.     /**
  70.      * @ORM\Column(type="integer", nullable=true)
  71.      * @Assert\NotBlank()
  72.      */
  73.     private $service_state_id;
  74.     /**
  75.      * @ORM\Column(type="integer", nullable=true)
  76.      * @Assert\NotBlank()
  77.      */
  78.     private $cities_count;
  79.     /**
  80.      * @return mixed
  81.      */
  82.     public function getId()
  83.     {
  84.         return $this->id;
  85.     }
  86.     /**
  87.      * @return mixed
  88.      */
  89.     public function getName()
  90.     {
  91.         return $this->name;
  92.     }
  93.     /**
  94.      * @param mixed $name
  95.      */
  96.     public function setName($name)
  97.     {
  98.         $this->name $name;
  99.     }
  100.     /**
  101.      * @return mixed
  102.      */
  103.     public function getOriginalName()
  104.     {
  105.         return $this->original_name;
  106.     }
  107.     /**
  108.      * @param mixed $original_name
  109.      */
  110.     public function setOriginalName($original_name): void
  111.     {
  112.         $this->original_name $original_name;
  113.     }
  114.     /**
  115.      * @return mixed
  116.      */
  117.     public function getActive()
  118.     {
  119.         return $this->active;
  120.     }
  121.     /**
  122.      * @param mixed $active
  123.      */
  124.     public function setActive($active)
  125.     {
  126.         $this->active $active;
  127.     }
  128.     /**
  129.      * @return mixed
  130.      */
  131.     public function getWpAccessibilityCountry()
  132.     {
  133.         return $this->wp_accessibility_country;
  134.     }
  135.     /**
  136.      * @param mixed $wp_accessibility_country
  137.      */
  138.     public function setWpAccessibilityCountry($wp_accessibility_country)
  139.     {
  140.         $this->wp_accessibility_country $wp_accessibility_country;
  141.     }
  142.     /**
  143.      * @return mixed
  144.      */
  145.     public function getSearchCity()
  146.     {
  147.         return $this->search_city;
  148.     }
  149.     /**
  150.      * @param mixed $search_city
  151.      */
  152.     public function setSearchCity($search_city)
  153.     {
  154.         $this->search_city $search_city;
  155.     }
  156.     /**
  157.      * @return mixed
  158.      */
  159.     public function getStateCode()
  160.     {
  161.         return $this->state_code;
  162.     }
  163.     /**
  164.      * @param mixed $state_code
  165.      */
  166.     public function setStateCode($state_code)
  167.     {
  168.         $this->state_code $state_code;
  169.     }
  170.     /**
  171.      * @return mixed
  172.      */
  173.     public function getWpAccessibilityCities()
  174.     {
  175.         return $this->wp_accessibility_cities;
  176.     }
  177.     /**
  178.      * @param mixed $wp_accessibility_cities
  179.      */
  180.     public function setWpAccessibilityCities($wp_accessibility_cities)
  181.     {
  182.         $this->wp_accessibility_cities $wp_accessibility_cities;
  183.     }
  184.     /**
  185.      * @return mixed
  186.      */
  187.     public function getWebStateId()
  188.     {
  189.         return $this->web_state_id;
  190.     }
  191.     /**
  192.      * @param mixed $web_state_id
  193.      */
  194.     public function setWebStateId($web_state_id): void
  195.     {
  196.         $this->web_state_id $web_state_id;
  197.     }
  198.     /**
  199.      * @return mixed
  200.      */
  201.     public function getCitiesCount()
  202.     {
  203.         return $this->cities_count;
  204.     }
  205.     /**
  206.      * @param mixed $cities_count
  207.      */
  208.     public function setCitiesCount($cities_count): void
  209.     {
  210.         $this->cities_count $cities_count;
  211.     }
  212.     /**
  213.      * @return mixed
  214.      */
  215.     public function getServiceStateId()
  216.     {
  217.         return $this->service_state_id;
  218.     }
  219.     /**
  220.      * @param mixed $service_state_id
  221.      */
  222.     public function setServiceStateId($service_state_id): void
  223.     {
  224.         $this->service_state_id $service_state_id;
  225.     }
  226.     public function jsonSerialize()
  227.     {
  228.         return array(
  229.             'id' => $this->id,
  230.             'active' => $this->active,
  231.             'name' => $this->name,
  232.             'original_name' => $this->original_name,
  233.             'cities' => ($this->getWpAccessibilityCities() != NULL && $this->search_city == true) ? $this->getWpAccessibilityCities()->toArray() : NULL,
  234.             'state_code' => $this->state_code,
  235.             'search_city' => $this->search_city,
  236.             'web_state_id' => $this->web_state_id,
  237.             'cities_count' => $this->cities_count,
  238.             'service_state_id' => $this->service_state_id
  239.         );
  240.     }
  241.     /**
  242.      * @var string $created
  243.      *
  244.      * @ORM\Column(name="created_at", type="string", nullable=false)
  245.      */
  246.     protected $createdAt;
  247.     /**
  248.      * @var string $updated
  249.      *
  250.      * @ORM\Column(name="updated_at", type="string", nullable=false)
  251.      */
  252.     protected $updatedAt;
  253.     public function getCreatedAt()
  254.     {
  255.         return $this->createdAt;
  256.     }
  257.     public function setCreatedAt($createdAt)
  258.     {
  259.         $this->createdAt $createdAt;
  260.         return $this;
  261.     }
  262.     public function getUpdatedAt()
  263.     {
  264.         return $this->updatedAt;
  265.     }
  266.     public function setUpdatedAt($updatedAt)
  267.     {
  268.         $this->updatedAt $updatedAt;
  269.         return $this;
  270.     }
  271.     /**
  272.      * @ORM\PrePersist
  273.      * @ORM\PreUpdate
  274.      */
  275.     public function updatedTimestamps()
  276.     {
  277.         $this->setUpdatedAt(round(microtime(true) * 1000));
  278.         if ($this->getCreatedAt() === null) {
  279.             $this->setCreatedAt(round(microtime(true) * 1000));
  280.         }
  281.     }
  282.     public function __construct() {
  283.         $this->wp_accessibility_cities = new ArrayCollection();
  284.         $this->setCreatedAt(round(microtime(true) * 1000));
  285.     }
  286. }