src/Flexy/ShopBundle/Entity/Accounting/AccountClass.php line 14
<?php
namespace App\Flexy\ShopBundle\Entity\Accounting;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\Flexy\ShopBundle\Entity\Accounting\AccountClassRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: AccountClassRepository::class)]
#[ApiResource]
class AccountClass
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[ORM\OneToMany(mappedBy: 'accountClass', targetEntity: Account::class, orphanRemoval: true)]
private Collection $accountes;
public function __construct()
{
$this->accountes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection<int, Account>
*/
public function getAccountes(): Collection
{
return $this->accountes;
}
public function addAccounte(Account $accounte): self
{
if (!$this->accountes->contains($accounte)) {
$this->accountes->add($accounte);
$accounte->setAccountClass($this);
}
return $this;
}
public function removeAccounte(Account $accounte): self
{
if ($this->accountes->removeElement($accounte)) {
// set the owning side to null (unless already changed)
if ($accounte->getAccountClass() === $this) {
$accounte->setAccountClass(null);
}
}
return $this;
}
}