src/Flexy/ShopBundle/Entity/Accounting/AccountClass.php line 14

  1. <?php
  2. namespace App\Flexy\ShopBundle\Entity\Accounting;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use App\Repository\Flexy\ShopBundle\Entity\Accounting\AccountClassRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassAccountClassRepository::class)]
  10. #[ApiResource]
  11. class AccountClass
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[ORM\Column(length255)]
  18.     private ?string $name null;
  19.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  20.     private ?string $description null;
  21.     #[ORM\OneToMany(mappedBy'accountClass'targetEntityAccount::class, orphanRemovaltrue)]
  22.     private Collection $accountes;
  23.     public function __construct()
  24.     {
  25.         $this->accountes = new ArrayCollection();
  26.     }
  27.     public function getId(): ?int
  28.     {
  29.         return $this->id;
  30.     }
  31.     public function getName(): ?string
  32.     {
  33.         return $this->name;
  34.     }
  35.     public function setName(string $name): self
  36.     {
  37.         $this->name $name;
  38.         return $this;
  39.     }
  40.     public function getDescription(): ?string
  41.     {
  42.         return $this->description;
  43.     }
  44.     public function setDescription(?string $description): self
  45.     {
  46.         $this->description $description;
  47.         return $this;
  48.     }
  49.     /**
  50.      * @return Collection<int, Account>
  51.      */
  52.     public function getAccountes(): Collection
  53.     {
  54.         return $this->accountes;
  55.     }
  56.     public function addAccounte(Account $accounte): self
  57.     {
  58.         if (!$this->accountes->contains($accounte)) {
  59.             $this->accountes->add($accounte);
  60.             $accounte->setAccountClass($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removeAccounte(Account $accounte): self
  65.     {
  66.         if ($this->accountes->removeElement($accounte)) {
  67.             // set the owning side to null (unless already changed)
  68.             if ($accounte->getAccountClass() === $this) {
  69.                 $accounte->setAccountClass(null);
  70.             }
  71.         }
  72.         return $this;
  73.     }
  74. }