CirilCivil.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use ApiPlatform\Metadata\ApiResource;
  5. use App\Entity\Core\File;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9. * TODO: documenter.
  10. */
  11. #[ApiResource(operations: [])]
  12. #[ORM\Entity]
  13. class CirilCivil
  14. {
  15. #[ORM\Id]
  16. #[ORM\Column]
  17. #[ORM\GeneratedValue]
  18. private int $id;
  19. /** @var Collection<int, Bill> */
  20. #[ORM\OneToMany(targetEntity: Bill::class, mappedBy: 'cirilCivil', cascade: ['persist'], orphanRemoval: true)]
  21. protected Collection $bills;
  22. #[ORM\OneToOne(targetEntity: File::class, cascade: ['persist'])]
  23. protected ?File $file;
  24. public function getId(): int
  25. {
  26. return $this->id;
  27. }
  28. public function setId(int $id): self
  29. {
  30. $this->id = $id;
  31. return $this;
  32. }
  33. public function getBills(): Collection
  34. {
  35. return $this->bills;
  36. }
  37. public function addBill(Bill $bill): self
  38. {
  39. if (!$this->bills->contains($bill)) {
  40. $this->bills[] = $bill;
  41. $bill->setCirilCivil($this);
  42. }
  43. return $this;
  44. }
  45. public function removeBill(Bill $bill): self
  46. {
  47. $this->bills->removeElement($bill);
  48. return $this;
  49. }
  50. public function getFile(): ?File
  51. {
  52. return $this->file;
  53. }
  54. public function setFile(?File $file): self
  55. {
  56. $this->file = $file;
  57. return $this;
  58. }
  59. }