src/Entity/JournalComptable.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\JournalComptableRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassJournalComptableRepository::class)]
  9. class JournalComptable
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length10uniquetrue)]
  16.     private ?string $code null;
  17.     #[ORM\Column(length100)]
  18.     private ?string $libelle null;
  19.     #[ORM\Column(length50)]
  20.     private ?string $type null// VENTE, ACHAT, BANQUE, CAISSE, OD
  21.     #[ORM\Column]
  22.     private ?bool $estActif true;
  23.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  24.     private ?string $description null;
  25.     #[ORM\OneToMany(mappedBy'journal'targetEntityEcritureComptable::class)]
  26.     private Collection $ecrituresComptables;
  27.     public function __construct()
  28.     {
  29.         $this->ecrituresComptables = new ArrayCollection();
  30.     }
  31.     public function getId(): ?int
  32.     {
  33.         return $this->id;
  34.     }
  35.     public function getCode(): ?string
  36.     {
  37.         return $this->code;
  38.     }
  39.     public function setCode(string $code): static
  40.     {
  41.         $this->code $code;
  42.         return $this;
  43.     }
  44.     public function getLibelle(): ?string
  45.     {
  46.         return $this->libelle;
  47.     }
  48.     public function setLibelle(string $libelle): static
  49.     {
  50.         $this->libelle $libelle;
  51.         return $this;
  52.     }
  53.     public function getType(): ?string
  54.     {
  55.         return $this->type;
  56.     }
  57.     public function setType(string $type): static
  58.     {
  59.         $this->type $type;
  60.         return $this;
  61.     }
  62.     public function isEstActif(): ?bool
  63.     {
  64.         return $this->estActif;
  65.     }
  66.     public function setEstActif(bool $estActif): static
  67.     {
  68.         $this->estActif $estActif;
  69.         return $this;
  70.     }
  71.     public function getDescription(): ?string
  72.     {
  73.         return $this->description;
  74.     }
  75.     public function setDescription(?string $description): static
  76.     {
  77.         $this->description $description;
  78.         return $this;
  79.     }
  80.     /**
  81.      * @return Collection<int, EcritureComptable>
  82.      */
  83.     public function getEcrituresComptables(): Collection
  84.     {
  85.         return $this->ecrituresComptables;
  86.     }
  87.     public function addEcritureComptable(EcritureComptable $ecritureComptable): static
  88.     {
  89.         if (!$this->ecrituresComptables->contains($ecritureComptable)) {
  90.             $this->ecrituresComptables->add($ecritureComptable);
  91.             $ecritureComptable->setJournal($this);
  92.         }
  93.         return $this;
  94.     }
  95.     public function removeEcritureComptable(EcritureComptable $ecritureComptable): static
  96.     {
  97.         if ($this->ecrituresComptables->removeElement($ecritureComptable)) {
  98.             if ($ecritureComptable->getJournal() === $this) {
  99.                 $ecritureComptable->setJournal(null);
  100.             }
  101.         }
  102.         return $this;
  103.     }
  104.     public function __toString(): string
  105.     {
  106.         return $this->code ' - ' $this->libelle;
  107.     }
  108. }