src/Entity/PriceLevel.php line 17

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\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Gedmo\Translatable\Translatable;
  9. /**
  10.  * @ORM\Entity(repositoryClass="App\EntityRepo\PriceLevelRepo")
  11.  * @ORM\Table(name="price_level")
  12.  * @Gedmo\TranslationEntity(class="App\Entity\PriceLevelTranslation")
  13.   */
  14. class PriceLevel implements Translatable
  15. {
  16.     /**
  17.      * @ORM\Column(type="integer")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */ 
  21.     private $priceLevelId=0;
  22.     /**
  23.      * @Gedmo\Translatable    
  24.      * @ORM\Column(type="string", length=100)
  25.      */
  26.     protected $priceLevelName;
  27.     /**
  28.      * @Gedmo\Translatable
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     protected $priceLevelDescription;     
  32.     /**
  33.      * Post locale
  34.      * Used locale to override Translation listener's locale
  35.      *
  36.      * @Gedmo\Locale
  37.      * 
  38.      */
  39.     protected $locale;
  40.     /*
  41.      * @ORM\ManyToMany(targetEntity="Contact", mappedBy="priceLevel")
  42.      */
  43.     //protected $contacts;
  44.     public function __construct()
  45.     {
  46.         $this->contacts = new ArrayCollection();
  47.     }
  48.     /**
  49.      * Get priceLevelId
  50.      *
  51.      * @return integer
  52.      */
  53.     public function getPriceLevelId()
  54.     {
  55.         return $this->priceLevelId;
  56.     }
  57.     /**
  58.      * Set priceLevelName
  59.      *
  60.      * @param string $priceLevelName
  61.      *
  62.      * @return PriceLevel
  63.      */
  64.     public function setPriceLevelName($priceLevelName)
  65.     {
  66.         $this->priceLevelName $priceLevelName;
  67.         return $this;
  68.     }
  69.     /**
  70.      * Get priceLevelName
  71.      *
  72.      * @return string
  73.      */
  74.     public function getPriceLevelName()
  75.     {
  76.         return $this->priceLevelName;
  77.     }
  78.     /**
  79.      * Set priceLevelDescription
  80.      *
  81.      * @param string $priceLevelDescription
  82.      *
  83.      * @return PriceLevel
  84.      */
  85.     public function setPriceLevelDescription($priceLevelDescription)
  86.     {
  87.         $this->priceLevelDescription $priceLevelDescription;
  88.         return $this;
  89.     }
  90.     /**
  91.      * Get priceLevelDescription
  92.      *
  93.      * @return string
  94.      */
  95.     public function getPriceLevelDescription()
  96.     {
  97.         return $this->priceLevelDescription;
  98.     }
  99.     /**
  100.      * Set locale
  101.      *
  102.      * @param string $locale
  103.      *
  104.      * @return Product
  105.      */
  106.     public function setLocale($locale)
  107.     {
  108.         $this->locale $locale;
  109.         return $this;
  110.     }
  111.     /**
  112.      * Get locale
  113.      *
  114.      * @return string
  115.      */
  116.     public function getLocale()
  117.     {
  118.         return $this->locale;
  119.     }
  120.     /**
  121.      * @return Collection<int, Contact>
  122.      */
  123.     public function getContacts(): Collection
  124.     {
  125.         return $this->contacts;
  126.     }
  127.     public function addContact(Contact $contact): self
  128.     {
  129.         if (!$this->contacts->contains($contact)) {
  130.             $this->contacts->add($contact);
  131.             $contact->addPriceLevel($this);
  132.         }
  133.         return $this;
  134.     }
  135.     public function removeContact(Contact $contact): self
  136.     {
  137.         if ($this->contacts->removeElement($contact)) {
  138.             $contact->removePriceLevel($this);
  139.         }
  140.         return $this;
  141.     }        
  142. }