177 lines
3.7 KiB
PHP
177 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\AccountingRepository;
|
|
use Doctrine\Common\Collections\ArrayCollection;
|
|
use Doctrine\Common\Collections\Collection;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: AccountingRepository::class)]
|
|
class Accounting
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $num01 = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $num02 = null;
|
|
|
|
#[ORM\Column(length: 255)]
|
|
private ?string $title = null;
|
|
|
|
#[ORM\Column]
|
|
private ?bool $actif = null;
|
|
|
|
#[ORM\ManyToOne(inversedBy: 'accountings')]
|
|
#[ORM\JoinColumn(nullable: false)]
|
|
private ?Company $company = null;
|
|
|
|
/**
|
|
* @var Collection<int, Operation>
|
|
*/
|
|
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'credit', orphanRemoval: true)]
|
|
private Collection $credits;
|
|
|
|
/**
|
|
* @var Collection<int, Operation>
|
|
*/
|
|
#[ORM\OneToMany(targetEntity: Operation::class, mappedBy: 'debit', orphanRemoval: true)]
|
|
private Collection $debits;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->credits = new ArrayCollection();
|
|
$this->debits = new ArrayCollection();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getNum01(): ?string
|
|
{
|
|
return $this->num01;
|
|
}
|
|
|
|
public function setNum01(string $num01): static
|
|
{
|
|
$this->num01 = $num01;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getNum02(): ?string
|
|
{
|
|
return $this->num02;
|
|
}
|
|
|
|
public function setNum02(string $num02): static
|
|
{
|
|
$this->num02 = $num02;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTitle(): ?string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
public function setTitle(string $title): static
|
|
{
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function isActif(): ?bool
|
|
{
|
|
return $this->actif;
|
|
}
|
|
|
|
public function setActif(bool $actif): static
|
|
{
|
|
$this->actif = $actif;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCompany(): ?Company
|
|
{
|
|
return $this->company;
|
|
}
|
|
|
|
public function setCompany(?Company $company): static
|
|
{
|
|
$this->company = $company;
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Operation>
|
|
*/
|
|
public function getCredits(): Collection
|
|
{
|
|
return $this->credits;
|
|
}
|
|
|
|
public function addCredit(Operation $credit): static
|
|
{
|
|
if (!$this->credits->contains($credit)) {
|
|
$this->credits->add($credit);
|
|
$credit->setCredit($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeCredit(Operation $credit): static
|
|
{
|
|
if ($this->credits->removeElement($credit)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($credit->getCredit() === $this) {
|
|
$credit->setCredit(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return Collection<int, Operation>
|
|
*/
|
|
public function getDebits(): Collection
|
|
{
|
|
return $this->debits;
|
|
}
|
|
|
|
public function addDebit(Operation $debit): static
|
|
{
|
|
if (!$this->debits->contains($debit)) {
|
|
$this->debits->add($debit);
|
|
$debit->setDebit($this);
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function removeDebit(Operation $debit): static
|
|
{
|
|
if ($this->debits->removeElement($debit)) {
|
|
// set the owning side to null (unless already changed)
|
|
if ($debit->getDebit() === $this) {
|
|
$debit->setDebit(null);
|
|
}
|
|
}
|
|
|
|
return $this;
|
|
}
|
|
}
|