Ciril.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. namespace AppBundle\Entity\Billing;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use AppBundle\Entity\Booking\EducationalProject;
  5. use AppBundle\Entity\Core\File;
  6. use AppBundle\Entity\Product\EquipmentLoan;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Dunglas\ApiBundle\Annotation\Iri;
  9. use Symfony\Component\Serializer\Annotation\Groups;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. use AppBundle\Entity\Traits\TimestampableEntity;
  12. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. /**
  16. * Fais le lien entre les Bill concernées par l'export et le File généré
  17. *
  18. * @Iri("http://schema.org/Ciril")
  19. */
  20. #[ORM\Entity]
  21. class Ciril
  22. {
  23. use TimestampableEntity;
  24. use CreatorUpdaterEntity;
  25. /**
  26. * @var int
  27. */
  28. #[ORM\Column(type: 'integer')]
  29. #[ORM\Id]
  30. #[ORM\GeneratedValue(strategy: 'AUTO')]
  31. #[Groups(['ciril'])]
  32. private $id;
  33. /**
  34. * @var ArrayCollection<Bill>
  35. */
  36. #[ORM\OneToMany(targetEntity: 'Bill', mappedBy: 'ciril', cascade: ['persist'], orphanRemoval: true)]
  37. #[Groups(['ciril_bills'])]
  38. private $bills;
  39. /**
  40. * @var \DateTime
  41. */
  42. #[ORM\Column(type: 'date', nullable: true)]
  43. #[Assert\Date]
  44. #[Groups(['ciril', 'ciril_list'])]
  45. private $date;
  46. /**
  47. * @var File
  48. */
  49. #[Assert\Valid]
  50. #[ORM\OneToOne(targetEntity: 'AppBundle\Entity\Core\File', cascade: ['persist'], fetch: 'EAGER')]
  51. #[ORM\JoinColumn(nullable: true)]
  52. #[Groups(['ciril', 'ciril_list'])]
  53. private $file;
  54. /**
  55. * The constructor
  56. */
  57. public function __construct() {
  58. $this->bills = new ArrayCollection();
  59. }
  60. /**
  61. * Sets id.
  62. *
  63. * @param int $id
  64. *
  65. * @return $this
  66. */
  67. public function setId($id)
  68. {
  69. $this->id = $id;
  70. return $this;
  71. }
  72. /**
  73. * Gets id.
  74. *
  75. * @return int
  76. */
  77. public function getId()
  78. {
  79. return $this->id;
  80. }
  81. /**
  82. * Set date
  83. *
  84. * @param \DateTime $date
  85. *
  86. * @return Ciril
  87. */
  88. public function setDate($date)
  89. {
  90. $this->date = $date;
  91. return $this;
  92. }
  93. /**
  94. * Get date
  95. *
  96. * @return \DateTime
  97. */
  98. public function getDate()
  99. {
  100. return $this->date;
  101. }
  102. /**
  103. * Add bill
  104. *
  105. * @param \AppBundle\Entity\Billing\Bill $bill
  106. *
  107. * @return Ciril
  108. */
  109. public function addBill(\AppBundle\Entity\Billing\Bill $bill)
  110. {
  111. $this->bills[] = $bill;
  112. return $this;
  113. }
  114. /**
  115. * Remove bill
  116. *
  117. * @param \AppBundle\Entity\Billing\Bill $bill
  118. */
  119. public function removeBill(\AppBundle\Entity\Billing\Bill $bill)
  120. {
  121. $this->bills->removeElement($bill);
  122. }
  123. /**
  124. * Get bills
  125. *
  126. * @return \Doctrine\Common\Collections\Collection
  127. */
  128. public function getBills()
  129. {
  130. return $this->bills;
  131. }
  132. /**
  133. * Set file
  134. *
  135. * @param \AppBundle\Entity\Core\File $file
  136. *
  137. * @return Ciril
  138. */
  139. public function setFile(\AppBundle\Entity\Core\File $file = null)
  140. {
  141. $this->file = $file;
  142. return $this;
  143. }
  144. /**
  145. * Get file
  146. *
  147. * @return \AppBundle\Entity\Core\File
  148. */
  149. public function getFile()
  150. {
  151. return $this->file;
  152. }
  153. }