Document.php 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. <?php
  2. namespace AppBundle\Entity\Core;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Dunglas\ApiBundle\Annotation\Iri;
  5. use Symfony\Component\Serializer\Annotation\Groups;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use AppBundle\Entity\Traits\TimestampableEntity;
  8. use AppBundle\Entity\Traits\CreatorUpdaterEntity;
  9. use AppBundle\Entity\Organization\Organization;
  10. use AppBundle\Entity\AccessAndFunction\Access;
  11. use Gedmo\Mapping\Annotation as Gedmo;
  12. use AppBundle\Annotation\DefaultField;
  13. /**
  14. * (Non utilisé, à confirmer)
  15. *
  16. * @Iri("http://schema.org/Document")
  17. */
  18. #[ORM\Entity(repositoryClass: 'AppBundle\Entity\Core\Repository\DocumentRepository')]
  19. class Document
  20. {
  21. use TimestampableEntity;
  22. use CreatorUpdaterEntity;
  23. /**
  24. * @var int
  25. */
  26. #[ORM\Column(type: 'integer')]
  27. #[ORM\Id]
  28. #[ORM\GeneratedValue(strategy: 'AUTO')]
  29. #[Groups(['document'])]
  30. private $id;
  31. /**
  32. * @var string
  33. */
  34. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  35. #[Assert\Type(type: 'string')]
  36. #[Groups(['document'])]
  37. private $name;
  38. /**
  39. * @Gedmo\Slug(fields={"name", "createDate"}, style="camel", separator="_", suffix="html.twig")
  40. */
  41. #[ORM\Column(length: 255, unique: true)]
  42. private $slug;
  43. /**
  44. * @var Access
  45. *
  46. * @DefaultField
  47. */
  48. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\AccessAndFunction\Access', inversedBy: 'documentAuthors')]
  49. #[ORM\JoinColumn(referencedColumnName: 'id', nullable: true, onDelete: 'SET NULL')]
  50. #[ORM\JoinColumn(nullable: true)]
  51. #[Groups(['document'])]
  52. private $author;
  53. /**
  54. * @var Organization
  55. * @DefaultField
  56. */
  57. #[ORM\ManyToOne(targetEntity: 'AppBundle\Entity\Organization\Organization', inversedBy: 'documents')]
  58. #[ORM\JoinColumn(nullable: true)]
  59. #[Groups(['document'])]
  60. private $organization;
  61. /**
  62. * @var string
  63. */
  64. #[ORM\Column(type: 'string', length: 255, nullable: true)]
  65. #[Assert\Type(type: 'string')]
  66. #[Groups(['document'])]
  67. private $about;
  68. /**
  69. * @var string
  70. */
  71. #[ORM\Column(type: 'text', nullable: true)]
  72. #[Assert\Type(type: 'string')]
  73. #[Groups(['document'])]
  74. private $headline;
  75. /**
  76. * @var string
  77. */
  78. #[ORM\Column(type: 'text', nullable: true)]
  79. #[Assert\Type(type: 'string')]
  80. #[Groups(['document'])]
  81. private $text;
  82. /**
  83. * @var bool
  84. */
  85. #[ORM\Column(type: 'boolean', options: ['default' => 0])]
  86. #[Assert\Type(type: 'boolean')]
  87. #[Assert\NotNull]
  88. #[Groups(['super_admin'])]
  89. private $isSystem = false;
  90. /**
  91. * @var bool
  92. */
  93. #[ORM\Column(type: 'boolean', options: ['default' => 0])]
  94. #[Assert\Type(type: 'boolean')]
  95. #[Assert\NotNull]
  96. #[Groups(['document'])]
  97. private $template = false;
  98. /**
  99. * The constructor
  100. *
  101. * @param string $about
  102. * @param string $headline
  103. * @param string $text
  104. */
  105. public function __construct($about = null, $headline = null, $text = null) {
  106. $this->about = $about;
  107. $this->headline = $headline;
  108. $this->text = $text;
  109. }
  110. /**
  111. * Sets id.
  112. *
  113. * @param int $id
  114. *
  115. * @return $this
  116. */
  117. public function setId($id) {
  118. $this->id = $id;
  119. return $this;
  120. }
  121. /**
  122. * Gets id.
  123. *
  124. * @return int
  125. */
  126. public function getId() {
  127. return $this->id;
  128. }
  129. /**
  130. * Sets name.
  131. *
  132. * @param string $name
  133. *
  134. * @return $this
  135. */
  136. public function setName($name) {
  137. $this->name = $name;
  138. return $this;
  139. }
  140. /**
  141. * Gets name.
  142. *
  143. * @return string
  144. */
  145. public function getName() {
  146. return $this->name;
  147. }
  148. /**
  149. * Sets author.
  150. *
  151. * @param Access $author
  152. *
  153. * @return $this
  154. */
  155. public function setAuthor(Access $author) {
  156. $this->author = $author;
  157. return $this;
  158. }
  159. /**
  160. * Gets author.
  161. *
  162. * @return Access
  163. */
  164. public function getAuthor() {
  165. return $this->author;
  166. }
  167. /**
  168. * Sets organization.
  169. *
  170. * @param Organization $organization
  171. *
  172. * @return $this
  173. */
  174. public function setOrganization(Organization $organization = null) {
  175. $this->organization = $organization;
  176. return $this;
  177. }
  178. /**
  179. * Gets organization.
  180. *
  181. * @return Organization
  182. */
  183. public function getOrganization() {
  184. return $this->organization;
  185. }
  186. /**
  187. * Sets about.
  188. *
  189. * @param string $about
  190. *
  191. * @return $this
  192. */
  193. public function setAbout($about) {
  194. $this->about = $about;
  195. return $this;
  196. }
  197. /**
  198. * Gets about.
  199. *
  200. * @return string
  201. */
  202. public function getAbout() {
  203. return $this->about;
  204. }
  205. /**
  206. * Sets headline.
  207. *
  208. * @param string $headline
  209. *
  210. * @return $this
  211. */
  212. public function setHeadline($headline) {
  213. $this->headline = $headline;
  214. return $this;
  215. }
  216. /**
  217. * Gets headline.
  218. *
  219. * @return string
  220. */
  221. public function getHeadline() {
  222. return $this->headline;
  223. }
  224. /**
  225. * Set text
  226. *
  227. * @param string $text
  228. *
  229. * @return Template
  230. */
  231. public function setText($text)
  232. {
  233. $this->text = $text;
  234. return $this;
  235. }
  236. /**
  237. * Get text
  238. *
  239. * @return string
  240. */
  241. public function getText()
  242. {
  243. return $this->text;
  244. }
  245. /**
  246. * Sets isSystem.
  247. *
  248. * @param bool $isSystem
  249. *
  250. * @return $this
  251. */
  252. public function setIsSystem($isSystem) {
  253. $this->isSystem = $isSystem;
  254. return $this;
  255. }
  256. /**
  257. * Gets isSystem.
  258. *
  259. * @return bool
  260. */
  261. public function getIsSystem() {
  262. return $this->isSystem;
  263. }
  264. /**
  265. * Is isSystem.
  266. *
  267. * @return bool
  268. */
  269. public function isSystem() {
  270. return $this->isSystem;
  271. }
  272. /**
  273. * Sets is a template.
  274. *
  275. * @param bool $template
  276. *
  277. * @return $this
  278. */
  279. public function setTemplate($template) {
  280. $this->template = $template;
  281. return $this;
  282. }
  283. /**
  284. * Gets template.
  285. *
  286. * @return bool
  287. */
  288. public function getTemplate() {
  289. return $this->template;
  290. }
  291. /**
  292. * Is a template
  293. *
  294. * @return bool
  295. */
  296. public function isTemplate() {
  297. return $this->template;
  298. }
  299. /**
  300. *
  301. *
  302. * @return string
  303. */
  304. public function getSlug()
  305. {
  306. return $this->slug;
  307. }
  308. }