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.         public function getId(): ?string
  40.         {
  41.             return $this->id;
  42.         }
  43.         public function getValue(): ?string
  44.         {
  45.             return $this->value;
  46.         }
  47.         public function setValue(string $value): static
  48.         {
  49.             $this->value $value;
  50.             return $this;
  51.         }
  52.         public function getSlug(): ?string
  53.         {
  54.             return $this->slug;
  55.         }
  56.         public function setSlug(string $slug): static
  57.         {
  58.             $this->slug $slug;
  59.             return $this;
  60.         }
  61.         /**
  62.          * @return Collection<int, AccountType>
  63.          */
  64.         public function getTypes(): Collection
  65.         {
  66.             return $this->types;
  67.         }
  68.         public function addType(AccountType $type): static
  69.         {
  70.             if (!$this->types->contains($type)) {
  71.                 $this->types->add($type);
  72.                 $type->setCategory($this);
  73.             }
  74.             return $this;
  75.         }
  76.         public function removeType(AccountType $type): static
  77.         {
  78.             if ($this->types->removeElement($type)) {
  79.                 // set the owning side to null (unless already changed)
  80.                 if ($type->getCategory() === $this) {
  81.                     $type->setCategory(null);
  82.                 }
  83.             }
  84.             return $this;
  85.         }
  86. }