src/Entity/Slave/AccountCategory.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  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. /**
  8.  * @ORM\Table(name="eposm_s_account_category")
  9.  * @ORM\Entity
  10.  */
  11. class AccountCategory
  12. {
  13.     public function __toString(){
  14.         return $this->getValue();
  15.     }
  16.     /**
  17.      * @ORM\Column(name="id", type="bigint")
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="AUTO")
  20.      */
  21.     protected $id;
  22.     /**
  23.      * @ORM\Column(name="value", type="string", length=191)
  24.      */
  25.     protected $value;
  26.     /**
  27.      * @ORM\Column(name="slug", type="string", length=191)
  28.      */
  29.     protected $slug;
  30.     // OneToMany
  31.         /**
  32.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\AccountType", mappedBy="category")
  33.          */
  34.         private $types;
  35.         public function __construct()
  36.         {
  37.             $this->types = new ArrayCollection();
  38.         }
  39.     //
  40.     public function getId(): ?string
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getValue(): ?string
  45.     {
  46.         return $this->value;
  47.     }
  48.     public function setValue(string $value): self
  49.     {
  50.         $this->value $value;
  51.         return $this;
  52.     }
  53.     public function getSlug(): ?string
  54.     {
  55.         return $this->slug;
  56.     }
  57.     public function setSlug(string $slug): self
  58.     {
  59.         $this->slug $slug;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @return Collection<int, AccountType>
  64.      */
  65.     public function getTypes(): Collection
  66.     {
  67.         return $this->types;
  68.     }
  69.     public function addType(AccountType $type): self
  70.     {
  71.         if (!$this->types->contains($type)) {
  72.             $this->types->add($type);
  73.             $type->setCategory($this);
  74.         }
  75.         return $this;
  76.     }
  77.     public function removeType(AccountType $type): self
  78.     {
  79.         if ($this->types->removeElement($type)) {
  80.             // set the owning side to null (unless already changed)
  81.             if ($type->getCategory() === $this) {
  82.                 $type->setCategory(null);
  83.             }
  84.         }
  85.         return $this;
  86.     }
  87. }