<?php
namespace App\Entity;
use App\Repository\ClientDebitAccountRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: ClientDebitAccountRepository::class)]
#[ORM\Table(name: 'tb_clients_debit_account')]
#[ORM\HasLifecycleCallbacks]
class ClientDebitAccount
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: "integer", unique: true)]
private ?int $id;
#[ORM\Column(type: 'string', length: 30, nullable: true)]
private ?string $compte;
#[ORM\Column(type: 'string', length: 20, nullable: true)]
private ?string $currency;
#[ORM\Column(type: 'string', length: 20, nullable: true)]
private ?string $state;
#[ORM\ManyToOne(targetEntity: ClientDebit::class, inversedBy: 'clientDebitAccounts')]
private ?ClientDebit $clientDebit;
public function getId(): ?int
{
return $this->id;
}
public function getCompte(): ?string
{
return $this->compte;
}
public function setCompte(string $compte): self
{
$this->compte = $compte;
return $this;
}
public function getCurrency(): ?string
{
return $this->currency;
}
public function setCurrency(string $currency): self
{
$this->currency = $currency;
return $this;
}
public function getState(): ?string
{
return $this->state;
}
public function setState(string $state): self
{
$this->state = $state;
return $this;
}
public function getClientDebit(): ?ClientDebit
{
return $this->clientDebit;
}
public function setClientDebit(?ClientDebit $clientDebit): self
{
$this->clientDebit = $clientDebit;
return $this;
}
/**
* @ORM\PreUpdate
*/
public function onUpdate() {
$this->modifiedAt = new \DateTime();
}
public function __toString()
{
$cr = 'CDF';
if ($this->currency == '1')
$cr = 'USD';
elseif ($this->currency == '2')
$cr = 'EURO';
return $this->compte.'-'.$cr;
}
}