<?php
namespace App\Entity;
use App\Repository\ClientDebitRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientDebitRepository::class)]
#[ORM\Table(name: 'tb_clients_debit')]
#[ORM\HasLifecycleCallbacks]
class ClientDebit
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer", unique: true)]
private ?int $id;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $compteNumber;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $compteCode;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $compteGlobal;
#[ORM\Column(type: 'decimal', precision: 10, scale: 0, nullable: true)]
private ?string $amount;
#[ORM\Column(type: 'string', length: 20, nullable: true)]
private ?string $currency;
#[ORM\Column(type: 'date', nullable: true)]
private ?\DateTimeInterface $period;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $paid;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $type;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $createdAt;
#[ORM\Column(type: 'datetime', nullable: true)]
private ?\DateTimeInterface $modifiedAt;
#[ORM\ManyToOne(targetEntity: User::class)]
private ?User $validatedBy;
#[ORM\Column(type: 'boolean', nullable: true)]
private ?bool $deleted;
#[ORM\OneToMany(mappedBy: 'clientDebit', targetEntity: ClientDebitAccount::class)]
private Collection $clientDebitAccounts;
#[ORM\ManyToOne(targetEntity: AppAccount::class, inversedBy: 'clientDebits')]
private $appAccount;
#[ORM\OneToMany(mappedBy: 'clientDebit', targetEntity: ClientDebitRequest::class)]
private Collection $clientDebitRequests;
#[ORM\Column(type: 'string', length: 50, nullable: true)]
private ?string $code;
public function __construct()
{
$this->clientDebitAccounts = new ArrayCollection();
$this->clientDebitRequests = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return mixed
*/
public function getAppAccount()
{
return $this->appAccount;
}
/**
* @param mixed $appAccount
*/
public function setAppAccount($appAccount): void
{
$this->appAccount = $appAccount;
}
public function getCompteNumber(): ?string
{
return $this->compteNumber;
}
public function setCompteNumber(?string $compteNumber): self
{
$this->compteNumber = $compteNumber;
return $this;
}
public function getCompteCode(): ?string
{
return $this->compteCode;
}
public function setCompteCode(?string $compteCode): self
{
$this->compteCode = $compteCode;
return $this;
}
public function getCompteGlobal(): ?string
{
return $this->compteGlobal;
}
public function setCompteGlobal(?string $compteGlobal): self
{
$this->compteGlobal = $compteGlobal;
return $this;
}
public function getAmount(): ?string
{
return $this->amount;
}
public function setAmount(?string $amount): self
{
$this->amount = $amount;
return $this;
}
public function getCurrency(): ?string
{
return $this->currency;
}
public function setCurrency(?string $currency): self
{
$this->currency = $currency;
return $this;
}
public function getPeriod(): ?\DateTimeInterface
{
return $this->period;
}
public function setPeriod(?\DateTimeInterface $period): self
{
$this->period = $period;
return $this;
}
public function getPaid(): ?bool
{
return $this->paid;
}
public function setPaid(?bool $paid): self
{
$this->paid = $paid;
return $this;
}
public function getType(): ?int
{
return $this->type;
}
public function setType(?int $type): self
{
$this->type = $type;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getModifiedAt(): ?\DateTimeInterface
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeInterface $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
public function getValidatedBy(): ?User
{
return $this->validatedBy;
}
public function setValidatedBy(?User $validatedBy): self
{
$this->validatedBy = $validatedBy;
return $this;
}
/**
* @ORM\PreUpdate
*/
public function onUpdate() {
$this->modifiedAt = new \DateTime();
}
public function getDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(?bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
/**
* @return Collection|ClientDebitAccount[]
*/
public function getClientDebitAccounts(): Collection
{
return $this->clientDebitAccounts;
}
public function addClientDebitAccount(ClientDebitAccount $clientDebitAccount): self
{
if (!$this->clientDebitAccounts->contains($clientDebitAccount)) {
$this->clientDebitAccounts[] = $clientDebitAccount;
$clientDebitAccount->setClientDebit($this);
}
return $this;
}
public function removeClientDebitAccount(ClientDebitAccount $clientDebitAccount): self
{
if ($this->clientDebitAccounts->removeElement($clientDebitAccount)) {
// set the owning side to null (unless already changed)
if ($clientDebitAccount->getClientDebit() === $this) {
$clientDebitAccount->setClientDebit(null);
}
}
return $this;
}
/**
* @return Collection|ClientDebitRequest[]
*/
public function getClientDebitRequests(): Collection
{
return $this->clientDebitRequests;
}
public function addClientDebitRequest(ClientDebitRequest $clientDebitRequest): self
{
if (!$this->clientDebitRequests->contains($clientDebitRequest)) {
$this->clientDebitRequests[] = $clientDebitRequest;
$clientDebitRequest->setClientDebit($this);
}
return $this;
}
public function removeClientDebitRequest(ClientDebitRequest $clientDebitRequest): self
{
if ($this->clientDebitRequests->removeElement($clientDebitRequest)) {
// set the owning side to null (unless already changed)
if ($clientDebitRequest->getClientDebit() === $this) {
$clientDebitRequest->setClientDebit(null);
}
}
return $this;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(string $code): self
{
$this->code = $code;
return $this;
}
}