src/Entity/Debt.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DebtRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassDebtRepository::class)]
  8. class Debt
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\Column(type'float')]
  15.     private $amount 0;
  16.     #[ORM\Column(type'float')]
  17.     private $amountPayed 0;
  18.     #[ORM\ManyToOne(targetEntityPerson::class, inversedBy'debts')]
  19.     #[ORM\JoinColumn(nullablefalse)]
  20.     private $person;
  21.     #[ORM\ManyToOne(targetEntitySection::class)]
  22.     #[ORM\JoinColumn(nullablefalse)]
  23.     private $section;
  24.     #[ORM\ManyToOne(targetEntitySeason::class)]
  25.     private $season;
  26.     #[ORM\Column(type'string'length255)]
  27.     private $comment;
  28.     #[ORM\OneToMany(mappedBy'debt'targetEntityCartItemDebt::class, cascade: ['remove'])]
  29.     private Collection $cartItemDebts;
  30.     public function __construct()
  31.     {
  32.         $this->cartItemDebts = new ArrayCollection();
  33.     }
  34.     public function getId(): ?int
  35.     {
  36.         return $this->id;
  37.     }
  38.     public function getAmount(): ?float
  39.     {
  40.         return $this->amount;
  41.     }
  42.     public function setAmount(float $amount): self
  43.     {
  44.         $this->amount $amount;
  45.         return $this;
  46.     }
  47.     public function getPerson(): ?Person
  48.     {
  49.         return $this->person;
  50.     }
  51.     public function setPerson(?Person $person): self
  52.     {
  53.         $this->person $person;
  54.         return $this;
  55.     }
  56.     public function getSection(): ?Section
  57.     {
  58.         return $this->section;
  59.     }
  60.     public function setSection(?Section $section): self
  61.     {
  62.         $this->section $section;
  63.         return $this;
  64.     }
  65.     public function getSeason(): ?Season
  66.     {
  67.         return $this->season;
  68.     }
  69.     public function setSeason(?Season $season): self
  70.     {
  71.         $this->season $season;
  72.         return $this;
  73.     }
  74.     public function getAmountPayed(): ?float
  75.     {
  76.         return $this->amountPayed;
  77.     }
  78.     public function setAmountPayed(float $amountPayed): self
  79.     {
  80.         $this->amountPayed $amountPayed;
  81.         return $this;
  82.     }
  83.     public function getComment(): ?string
  84.     {
  85.         return $this->comment;
  86.     }
  87.     public function setComment(string $comment): self
  88.     {
  89.         $this->comment $comment;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return Collection<int, CartItemDebt>
  94.      */
  95.     public function getCartItemDebts(): Collection
  96.     {
  97.         return $this->cartItemDebts;
  98.     }
  99.     public function addCartItemDebt(CartItemDebt $cartItemDebt): self
  100.     {
  101.         if (!$this->cartItemDebts->contains($cartItemDebt)) {
  102.             $this->cartItemDebts->add($cartItemDebt);
  103.             $cartItemDebt->setDebt($this);
  104.         }
  105.         return $this;
  106.     }
  107.     public function removeCartItemDebt(CartItemDebt $cartItemDebt): self
  108.     {
  109.         if ($this->cartItemDebts->removeElement($cartItemDebt)) {
  110.             // set the owning side to null (unless already changed)
  111.             if ($cartItemDebt->getDebt() === $this) {
  112.                 $cartItemDebt->setDebt(null);
  113.             }
  114.         }
  115.         return $this;
  116.     }
  117. }