<?php
namespace App\Entity;
use ApiPlatform\Metadata\ApiResource;
use App\Repository\AccountsRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ApiPlatform\Metadata\ApiFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Serializer\Annotation\MaxDepth;
use ApiPlatform\Core\Annotation\ApiProperty;
#[ORM\Entity(repositoryClass: AccountsRepository::class)]
#[ApiResource(
normalizationContext: ['groups' => ['Acc:read']],
denormalizationContext: ['groups' => ['Acc:write']],
order: ['id' => 'DESC'],
)]
class Accounts
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['Acc:read'])]
private ?int $id = null;
#[Groups(['Acc:read', 'personalAcc:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $number = null;
#[ORM\OneToMany(mappedBy: 'accounts', targetEntity: AppPersonalAccount::class)]
private Collection $appPersonalAccounts;
#[Groups(['Acc:read', 'personalAcc:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $statusLight = null;
#[Groups(['Acc:read', 'personalAcc:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $statusPlanning = null;
#[Groups(['Acc:read', 'personalAcc:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $eic = null;
#[Groups(['Acc:read', 'personalAcc:read'])]
#[ORM\Column(length: 100, nullable: true)]
private ?string $eicParent = null;
public function __construct()
{
$this->appPersonalAccounts = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getNumber(): ?string
{
return $this->number;
}
public function setNumber(?string $number): static
{
$this->number = $number;
return $this;
}
/**
* @return Collection<int, AppPersonalAccount>
*/
public function getAppPersonalAccounts(): Collection
{
return $this->appPersonalAccounts;
}
public function addAppPersonalAccount(AppPersonalAccount $appPersonalAccount): static
{
if (!$this->appPersonalAccounts->contains($appPersonalAccount)) {
$this->appPersonalAccounts->add($appPersonalAccount);
$appPersonalAccount->setAccounts($this);
}
return $this;
}
public function removeAppPersonalAccount(AppPersonalAccount $appPersonalAccount): static
{
if ($this->appPersonalAccounts->removeElement($appPersonalAccount)) {
// set the owning side to null (unless already changed)
if ($appPersonalAccount->getAccounts() === $this) {
$appPersonalAccount->setAccounts(null);
}
}
return $this;
}
public function getStatusLight(): ?string
{
return $this->statusLight;
}
public function setStatusLight(?string $statusLight): static
{
$this->statusLight = $statusLight;
return $this;
}
public function getStatusPlanning(): ?string
{
return $this->statusPlanning;
}
public function setStatusPlanning(?string $statusPlanning): static
{
$this->statusPlanning = $statusPlanning;
return $this;
}
public function getEic(): ?string
{
return $this->eic;
}
public function setEic(?string $eic): static
{
$this->eic = $eic;
return $this;
}
public function getEicParent(): ?string
{
return $this->eicParent;
}
public function setEicParent(?string $eicParent): static
{
$this->eicParent = $eicParent;
return $this;
}
}