AccessFictionalIntangible.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <?php
  2. namespace AppBundle\Entity\Billing;
  3. use AppBundle\Entity\AccessAndFunction\Access;
  4. use AppBundle\Entity\AccessAndFunction\AccessFamily;
  5. use AppBundle\Entity\Organization\Organization;
  6. use AppBundle\Entity\Product\FictionalIntangible;
  7. use AppBundle\Entity\Product\Intangible;
  8. use AppBundle\Entity\Traits\BillingRuleTrait;
  9. use AppBundle\Entity\Traits\LockableTrait;
  10. use AppBundle\Enum\Billing\PeriodicityTypeEnum;
  11. use Doctrine\ORM\Mapping as ORM;
  12. use Dunglas\ApiBundle\Annotation\Iri;
  13. use Symfony\Component\Validator\Constraints as Assert;
  14. use Doctrine\Common\Collections\ArrayCollection;
  15. use Symfony\Component\Serializer\Annotation\Groups;
  16. use AppBundle\Annotation\DefaultField;
  17. use AppBundle\Entity\Traits\TimestampableEntity;
  18. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  19. /**
  20. * Correspond à une ligne de facturation pour un Access
  21. * (@see FictionalIntangible)
  22. *
  23. * @Iri("http://schema.org/AccessFictionalIntangible")
  24. */
  25. #[ORM\Entity]
  26. class AccessFictionalIntangible
  27. {
  28. use TimestampableEntity;
  29. use CreatorUpdaterEntity;
  30. use BillingRuleTrait;
  31. /**
  32. * @var int
  33. */
  34. #[ORM\Column(type: 'integer')]
  35. #[ORM\Id]
  36. #[ORM\GeneratedValue(strategy: 'AUTO')]
  37. #[Groups(['accessfictionalintangible'])]
  38. private $id;
  39. /**
  40. * @var Access
  41. */
  42. #[Assert\Valid]
  43. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'accessFictionalIntangibles', cascade: ['persist'])]
  44. #[Groups(['accessfictionalintangible'])]
  45. private $access;
  46. /**
  47. * @var AccessFamily
  48. */
  49. #[Assert\Valid]
  50. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\AccessFamily', inversedBy: 'accessFictionalIntangibles', cascade: ['persist'])]
  51. #[Groups(['accessfictionalintangible'])]
  52. private $accessFamily;
  53. /**
  54. * @var FictionalIntangible
  55. */
  56. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Product\FictionalIntangible')]
  57. #[ORM\JoinColumn(nullable: false)]
  58. #[Assert\NotNull]
  59. #[Groups(['accessfictionalintangible'])]
  60. private $fictionalIntangible;
  61. /**
  62. * @var ArrayCollection<BillingIntangibleExcludeDate>
  63. */
  64. #[Assert\Valid]
  65. #[ORM\OneToMany(targetEntity: 'BillingIntangibleExcludeDate', mappedBy: 'accessFictionalIntangible', cascade: ['persist'], orphanRemoval: true)]
  66. #[Groups(['accessfictionalintangible'])]
  67. private $billingIntangibleExcludeDates;
  68. /**
  69. * The constructor
  70. */
  71. public function __construct() {
  72. $this->billingIntangibleExcludeDates = new ArrayCollection();
  73. }
  74. /**
  75. * Sets id.
  76. *
  77. * @param int $id
  78. *
  79. * @return $this
  80. */
  81. public function setId($id)
  82. {
  83. $this->id = $id;
  84. return $this;
  85. }
  86. /**
  87. * Gets id.
  88. *
  89. * @return int
  90. */
  91. public function getId()
  92. {
  93. return $this->id;
  94. }
  95. /**
  96. * Set access
  97. *
  98. * @param \AppBundle\Entity\AccessAndFunction\Access $access
  99. *
  100. * @return AccessFictionalIntangible
  101. */
  102. public function setAccess(\AppBundle\Entity\AccessAndFunction\Access $access = null)
  103. {
  104. $access->addAccessFictionalIntangible($this);
  105. $this->access = $access;
  106. return $this;
  107. }
  108. /**
  109. * Get access
  110. *
  111. * @return \AppBundle\Entity\AccessAndFunction\Access
  112. */
  113. public function getAccess()
  114. {
  115. return $this->access;
  116. }
  117. /**
  118. * Set fictionalIntangible
  119. *
  120. * @param \AppBundle\Entity\Product\FictionalIntangible $fictionalIntangible
  121. *
  122. * @return AccessFictionalIntangible
  123. */
  124. public function setFictionalIntangible(\AppBundle\Entity\Product\FictionalIntangible $fictionalIntangible)
  125. {
  126. $this->fictionalIntangible = $fictionalIntangible;
  127. return $this;
  128. }
  129. /**
  130. * Get fictionalIntangible
  131. *
  132. * @return \AppBundle\Entity\Product\FictionalIntangible
  133. */
  134. public function getFictionalIntangible()
  135. {
  136. return $this->fictionalIntangible;
  137. }
  138. /**
  139. * Set accessFamily
  140. *
  141. * @param \AppBundle\Entity\AccessAndFunction\AccessFamily $accessFamily
  142. *
  143. * @return AccessFictionalIntangible
  144. */
  145. public function setAccessFamily(\AppBundle\Entity\AccessAndFunction\AccessFamily $accessFamily = null)
  146. {
  147. $accessFamily->addAccessFictionalIntangible($this);
  148. $this->accessFamily = $accessFamily;
  149. return $this;
  150. }
  151. /**
  152. * Get accessFamily
  153. *
  154. * @return \AppBundle\Entity\AccessAndFunction\AccessFamily
  155. */
  156. public function getAccessFamily()
  157. {
  158. return $this->accessFamily;
  159. }
  160. /**
  161. * Add billingIntangibleExcludeDate
  162. *
  163. * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
  164. *
  165. * @return AccessFictionalIntangible
  166. */
  167. public function addBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
  168. {
  169. $this->billingIntangibleExcludeDates[] = $billingIntangibleExcludeDate;
  170. return $this;
  171. }
  172. /**
  173. * Remove billingIntangibleExcludeDate
  174. *
  175. * @param \AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate
  176. */
  177. public function removeBillingIntangibleExcludeDate(\AppBundle\Entity\Billing\BillingIntangibleExcludeDate $billingIntangibleExcludeDate)
  178. {
  179. $this->billingIntangibleExcludeDates->removeElement($billingIntangibleExcludeDate);
  180. }
  181. /**
  182. * Get billingIntangibleExcludeDates
  183. *
  184. * @return \Doctrine\Common\Collections\Collection
  185. */
  186. public function getBillingIntangibleExcludeDates()
  187. {
  188. return $this->billingIntangibleExcludeDates;
  189. }
  190. }