src/Entity/CustomerSiteLevel.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. use Doctrine\Common\Collections\Criteria;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\CustomerSiteLevelRepository")
  10.  */
  11. class CustomerSiteLevel
  12. {
  13.     const LEVEL_PREMIUM        1000;
  14.     const LEVEL_BEST        2000;
  15.     const LEVEL_BETTER        3000;
  16.     const LEVEL_GOOD        4000;
  17.     const LEVEL_RCLUB        4001;
  18.     const LEVEL_PARTNER        5000;
  19.     const LEVEL_STANDARD    6000;
  20.     /**
  21.      * @ORM\Id()
  22.      * @ORM\GeneratedValue()
  23.      * @ORM\Column(type="bigint")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity="App\Entity\Customer", inversedBy="levels", cascade={"persist"})
  28.      * @ORM\JoinColumn(name="customer_id", referencedColumnName="id", onDelete="CASCADE")
  29.      */
  30.     private $customer;
  31.     
  32.     /* *
  33.      * @ ORM\ManyToOne(targetEntity="App\Entity\Site", inversedBy="levels", cascade={"persist"})
  34.      * @ ORM\JoinColumn(name="site_id", referencedColumnName="id", onDelete="CASCADE")
  35.      * /
  36.     private $site;*/
  37.     /**
  38.      * @ORM\Column(type="integer", length=11)
  39.      */
  40.     private $site_id;
  41.     /**
  42.      * @ORM\Column(type="integer")
  43.      */
  44.     private $level;
  45.     
  46.     public function __construct ()
  47.     {
  48.         $this->site_id 0;
  49.         $this->level 6000;
  50.     }
  51.     public function getCustomer(): ?Customer
  52.     {
  53.         return $this->customer;
  54.     }
  55.     public function setCustomer(?Customer $customer): self
  56.     {
  57.         $this->customer $customer;
  58.         return $this;
  59.     }
  60.     /*
  61.     public function getSite(): ?Site
  62.     {
  63.         return $this->site;
  64.     }
  65.     public function setSite(?Site $site): self
  66.     {
  67.         $this->site = $site;
  68.         return $this;
  69.     }
  70.     */
  71.     public function getSiteId(): int
  72.     {
  73.         return $this->site_id;
  74.     }
  75.     public function setSiteId(int $site_id): self
  76.     {
  77.         $this->site_id $site_id;
  78.         return $this;
  79.     }
  80.     public function getLevel(): ?int
  81.     {
  82.         return $this->level;
  83.     }
  84.     public function setLevel(int $level): self
  85.     {
  86.         $this->level $level;
  87.         return $this;
  88.     }
  89.     public function getCustomerLevelString()
  90.     {
  91.         switch($this->level) {
  92.             case 1000
  93.                 return "Premium";
  94.             case 2000
  95.                 return "Best";
  96.             case 3000
  97.                 return "Better";
  98.             case 4000
  99.                 return "Good";
  100.             case 5000
  101.                 return "Partner";
  102.             case 6000
  103.                 return "Standard";
  104.             default:
  105.                 return "Standard";
  106.         }
  107.     }
  108.     
  109. }