<?phpnamespace App\Entity;use App\Repository\JournalComptableRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;#[ORM\Entity(repositoryClass: JournalComptableRepository::class)]class JournalComptable{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 10, unique: true)] private ?string $code = null; #[ORM\Column(length: 100)] private ?string $libelle = null; #[ORM\Column(length: 50)] private ?string $type = null; // VENTE, ACHAT, BANQUE, CAISSE, OD #[ORM\Column] private ?bool $estActif = true; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $description = null; #[ORM\OneToMany(mappedBy: 'journal', targetEntity: EcritureComptable::class)] private Collection $ecrituresComptables; public function __construct() { $this->ecrituresComptables = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getCode(): ?string { return $this->code; } public function setCode(string $code): static { $this->code = $code; return $this; } public function getLibelle(): ?string { return $this->libelle; } public function setLibelle(string $libelle): static { $this->libelle = $libelle; return $this; } public function getType(): ?string { return $this->type; } public function setType(string $type): static { $this->type = $type; return $this; } public function isEstActif(): ?bool { return $this->estActif; } public function setEstActif(bool $estActif): static { $this->estActif = $estActif; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } /** * @return Collection<int, EcritureComptable> */ public function getEcrituresComptables(): Collection { return $this->ecrituresComptables; } public function addEcritureComptable(EcritureComptable $ecritureComptable): static { if (!$this->ecrituresComptables->contains($ecritureComptable)) { $this->ecrituresComptables->add($ecritureComptable); $ecritureComptable->setJournal($this); } return $this; } public function removeEcritureComptable(EcritureComptable $ecritureComptable): static { if ($this->ecrituresComptables->removeElement($ecritureComptable)) { if ($ecritureComptable->getJournal() === $this) { $ecritureComptable->setJournal(null); } } return $this; } public function __toString(): string { return $this->code . ' - ' . $this->libelle; }}