OrganizationArticle.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. namespace AppBundle\Entity\Organization;
  3. use AppBundle\Annotation\DefaultField;
  4. use AppBundle\Entity\Core\AddressPostal;
  5. use AppBundle\Enum\Core\AddressPostalTypeEnum;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Dunglas\ApiBundle\Annotation\Iri;
  8. use Symfony\Component\Serializer\Annotation\Groups;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use AppBundle\Entity\Traits\TimestampableEntity;
  11. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  12. /**
  13. * Lien entre une Organization et un article la concernant sur un site externe
  14. *
  15. * @Iri("http://schema.org/OrganizationArticle")
  16. */
  17. #[ORM\Entity]
  18. class OrganizationArticle
  19. {
  20. use TimestampableEntity;
  21. use CreatorUpdaterEntity;
  22. /**
  23. * @var int
  24. */
  25. #[ORM\Column(type: 'integer')]
  26. #[ORM\Id]
  27. #[ORM\GeneratedValue(strategy: 'AUTO')]
  28. #[Groups(['organizationarticle', 'organization_communication_edit', 'organization_cotisation_steps'])]
  29. private $id;
  30. /**
  31. * @var Organization
  32. *
  33. * @DefaultField
  34. */
  35. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'organizationArticles')]
  36. #[ORM\JoinColumn(nullable: false)]
  37. #[Assert\NotNull]
  38. #[Groups(['organizationarticle'])]
  39. private $organization;
  40. /**
  41. * @var string The title of the item.
  42. *
  43. * @Iri("https://schema.org/name")
  44. */
  45. #[ORM\Column(type: 'string', nullable: true, length: 128)]
  46. #[Assert\Type(type: 'string')]
  47. #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
  48. private $title;
  49. /**
  50. * @var string
  51. */
  52. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  53. #[Assert\Type(type: 'string')]
  54. #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
  55. private $link;
  56. /**
  57. * @var \DateTime
  58. */
  59. #[ORM\Column(type: 'date', nullable: true)]
  60. #[Assert\Date]
  61. #[Groups(['organizationarticle', 'organization_communication_edit_organizationarticles', 'organization_cotisation_steps_organizationarticles'])]
  62. private $date;
  63. /**
  64. * Sets id.
  65. *
  66. * @param int $id
  67. *
  68. * @return $this
  69. */
  70. public function setId($id)
  71. {
  72. $this->id = $id;
  73. return $this;
  74. }
  75. /**
  76. * Gets id.
  77. *
  78. * @return int
  79. */
  80. public function getId()
  81. {
  82. return $this->id;
  83. }
  84. /**
  85. * Sets organization.
  86. *
  87. * @param Organization $organization
  88. *
  89. * @return $this
  90. */
  91. public function setOrganization(Organization $organization)
  92. {
  93. $this->organization = $organization;
  94. return $this;
  95. }
  96. /**
  97. * Gets organization.
  98. *
  99. * @return Organization
  100. */
  101. public function getOrganization()
  102. {
  103. return $this->organization;
  104. }
  105. /**
  106. * Set title
  107. *
  108. * @param string $title
  109. *
  110. * @return OrganizationArticle
  111. */
  112. public function setTitle($title)
  113. {
  114. $this->title = $title;
  115. return $this;
  116. }
  117. /**
  118. * Get title
  119. *
  120. * @return string
  121. */
  122. public function getTitle()
  123. {
  124. return $this->title;
  125. }
  126. /**
  127. * Set link
  128. *
  129. * @param string $link
  130. *
  131. * @return OrganizationArticle
  132. */
  133. public function setLink($link)
  134. {
  135. $this->link = $link;
  136. return $this;
  137. }
  138. /**
  139. * Get link
  140. *
  141. * @return string
  142. */
  143. public function getLink()
  144. {
  145. return $this->link;
  146. }
  147. /**
  148. * @return \DateTime
  149. */
  150. public function getDate()
  151. {
  152. return $this->date;
  153. }
  154. /**
  155. * @param \DateTime $date
  156. */
  157. public function setDate($date)
  158. {
  159. $this->date = $date;
  160. }
  161. }