EducationalProjectIntangible.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Billing;
  4. use App\Entity\Booking\EducationalProject;
  5. use DH\Auditor\Provider\Doctrine\Auditing\Annotation\Auditable;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10. * Classe ... qui ...
  11. */
  12. #[Auditable]
  13. #[ORM\Entity]
  14. class EducationalProjectIntangible
  15. {
  16. #[ORM\Id]
  17. #[ORM\Column]
  18. #[ORM\GeneratedValue]
  19. private ?int $id = null;
  20. #[ORM\ManyToOne(inversedBy: 'educationalProjectIntangibles')]
  21. private EducationalProject $educationalProject;
  22. #[ORM\OneToMany(mappedBy: 'educationalProjectIntangible', targetEntity: BillingIntangibleExcludeDate::class, cascade: ['persist'], orphanRemoval: true)]
  23. private Collection $billingIntangibleExcludeDates;
  24. public function __construct()
  25. {
  26. $this->billingIntangibleExcludeDates = new ArrayCollection();
  27. }
  28. public function getId(): ?int
  29. {
  30. return $this->id;
  31. }
  32. public function getEducationalProject(): ?EducationalProject
  33. {
  34. return $this->educationalProject;
  35. }
  36. public function setEducationalProject(?EducationalProject $educationalProject): self
  37. {
  38. $this->educationalProject = $educationalProject;
  39. return $this;
  40. }
  41. /**
  42. * @return Collection<int, BillingIntangibleExcludeDate>
  43. */
  44. public function getBillingIntangibleExcludeDates(): Collection
  45. {
  46. return $this->billingIntangibleExcludeDates;
  47. }
  48. public function addBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
  49. {
  50. if (!$this->billingIntangibleExcludeDates->contains($billingIntangibleExcludeDate)) {
  51. $this->billingIntangibleExcludeDates[] = $billingIntangibleExcludeDate;
  52. $billingIntangibleExcludeDate->setEducationalProjectIntangible($this);
  53. }
  54. return $this;
  55. }
  56. public function removeBillingIntangibleExcludeDate(BillingIntangibleExcludeDate $billingIntangibleExcludeDate): self
  57. {
  58. if ($this->billingIntangibleExcludeDates->removeElement($billingIntangibleExcludeDate)) {
  59. // set the owning side to null (unless already changed)
  60. if ($billingIntangibleExcludeDate->getEducationalProjectIntangible() === $this) {
  61. $billingIntangibleExcludeDate->setEducationalProjectIntangible(null);
  62. }
  63. }
  64. return $this;
  65. }
  66. }