src/Entity/ClientDebitAccount.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ClientDebitAccountRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassClientDebitAccountRepository::class)]
  6. #[ORM\Table(name'tb_clients_debit_account')]
  7. #[ORM\HasLifecycleCallbacks]
  8. class ClientDebitAccount
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type"integer"uniquetrue)]
  13.     private ?int $id;
  14.     #[ORM\Column(type'string'length30nullabletrue)]
  15.     private ?string $compte;
  16.     #[ORM\Column(type'string'length20nullabletrue)]
  17.     private ?string $currency;
  18.     #[ORM\Column(type'string'length20nullabletrue)]
  19.     private ?string $state;
  20.     #[ORM\ManyToOne(targetEntityClientDebit::class, inversedBy'clientDebitAccounts')]
  21.     private ?ClientDebit $clientDebit;
  22.     public function getId(): ?int
  23.     {
  24.         return $this->id;
  25.     }
  26.     public function getCompte(): ?string
  27.     {
  28.         return $this->compte;
  29.     }
  30.     public function setCompte(string $compte): self
  31.     {
  32.         $this->compte $compte;
  33.         return $this;
  34.     }
  35.     public function getCurrency(): ?string
  36.     {
  37.         return $this->currency;
  38.     }
  39.     public function setCurrency(string $currency): self
  40.     {
  41.         $this->currency $currency;
  42.         return $this;
  43.     }
  44.     public function getState(): ?string
  45.     {
  46.         return $this->state;
  47.     }
  48.     public function setState(string $state): self
  49.     {
  50.         $this->state $state;
  51.         return $this;
  52.     }
  53.     public function getClientDebit(): ?ClientDebit
  54.     {
  55.         return $this->clientDebit;
  56.     }
  57.     public function setClientDebit(?ClientDebit $clientDebit): self
  58.     {
  59.         $this->clientDebit $clientDebit;
  60.         return $this;
  61.     }
  62.     /**
  63.      * @ORM\PreUpdate
  64.      */
  65.     public function onUpdate() {
  66.         $this->modifiedAt = new \DateTime();
  67.     }
  68.     public function __toString()
  69.     {
  70.         $cr 'CDF';
  71.         if ($this->currency == '1')
  72.             $cr 'USD';
  73.         elseif ($this->currency == '2')
  74.             $cr 'EURO';
  75.         return $this->compte.'-'.$cr;
  76.     }
  77. }