src/Entity/Articles/Articles.php line 24

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Articles;
  3. use Doctrine\DBAL\Types\Types;
  4. use Symfony\Component\Serializer\Annotation\Groups;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use App\Repository\Articles\ArticlesRepository;
  11. use Symfony\Component\HttpFoundation\File\UploadedFile;
  12. use Vich\UploaderBundle\Entity\File as EmbeddedFile;
  13. /**
  14. * Articles
  15. *
  16. * @ORM\Table("articles_articles")
  17. * @ORM\Entity(repositoryClass=ArticlesRepository::class)
  18. * @ORM\HasLifecycleCallbacks()
  19. * @Vich\Uploadable
  20. */
  21. class Articles {
  22. /**
  23. * @var integer
  24. *
  25. * @ORM\Column(name="id", type="integer")
  26. * @ORM\Id
  27. * @ORM\GeneratedValue(strategy="AUTO")
  28. * [Groups(['list', 'item'])]
  29. */
  30. protected $id;
  31. /**
  32. * @var string
  33. *
  34. * @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
  35. */
  36. private $createdAt;
  37. /**
  38. * @var string
  39. *
  40. * @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
  41. */
  42. private $updatedAt;
  43. /**
  44. * @var string
  45. *
  46. * @ORM\Column(name="published_at", type="datetime", nullable=true)
  47. * [Groups(['list', 'item'])]
  48. */
  49. private $publishedAt;
  50. /**
  51. * @var string
  52. *
  53. * @ORM\Column(name="slug", type="string", length=255, nullable=true)
  54. */
  55. private $slug;
  56. /**
  57. * @var string
  58. *
  59. * @ORM\Column(name="title", type="string", length=500, nullable=true)
  60. * [Groups(['list', 'item'])]
  61. */
  62. private $title;
  63. /**
  64. * @var string
  65. *
  66. * @ORM\Column(name="title_ariane", type="string", length=500, nullable=true)
  67. */
  68. private $titleAriane;
  69. /**
  70. * @var string
  71. *
  72. * @ORM\Column(name="shortTitle", type="string", length=500, nullable=true)
  73. */
  74. private $shortTitle;
  75. /**
  76. * @var string
  77. *
  78. * @ORM\Column(name="subtitle", type="string", length=500, nullable=true)
  79. */
  80. private $subtitle;
  81. /**
  82. * @var string
  83. *
  84. * @ORM\Column(name="type", type="string", length=500, nullable=true)
  85. */
  86. private $type;
  87. /**
  88. * @var string
  89. *
  90. * @ORM\Column(name="short_description", type="text", nullable=true)
  91. */
  92. private $shortDescription;
  93. /**
  94. * @var string
  95. *
  96. * @ORM\Column(name="description", type="text", nullable=true)
  97. * [Groups(['list', 'item'])]
  98. */
  99. private $description;
  100. /**
  101. * @var string
  102. *
  103. * @ORM\Column(name="description_start", type="text", nullable=true)
  104. * [Groups(['list', 'item'])]
  105. */
  106. private $descriptionStart;
  107. /**
  108. * @var string
  109. *
  110. * @ORM\Column(name="tags", type="text", nullable=true)
  111. * [Groups(['list', 'item'])]
  112. */
  113. private $tags;
  114. /**
  115. * NOTE: This is not a mapped field of entity metadata, just a simple property.
  116. *
  117. * @Vich\UploadableField(mapping="articles_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions")
  118. *
  119. * @var File|null
  120. */
  121. private $imageFile;
  122. /**
  123. * @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
  124. *
  125. * @var EmbeddedFile
  126. */
  127. private $image;
  128. /**
  129. * @var string
  130. *
  131. * @ORM\Column(name="visibility", type="boolean", nullable=true)
  132. */
  133. private $visibility;
  134. /**
  135. * @var string
  136. *
  137. * @ORM\Column(name="language", type="text", nullable=true)
  138. */
  139. private $language;
  140. /**
  141. * @var string
  142. *
  143. * @ORM\Column(name="carousel", type="boolean", nullable=true)
  144. */
  145. private $carousel;
  146. /**
  147. * @var string
  148. *
  149. * @ORM\Column(name="featured", type="boolean", nullable=true)
  150. */
  151. private $featured;
  152. /**
  153. * @var string
  154. *
  155. * @ORM\Column(name="autopublished_at", type="datetime", nullable=true)
  156. */
  157. private $autopublishedAt;
  158. /**
  159. * @var string
  160. *
  161. * @ORM\Column(name="translation", type="text", nullable=true)
  162. */
  163. private $translation;
  164. /**
  165. * @var string
  166. *
  167. * @ORM\Column(name="sitemap", type="boolean", nullable=true)
  168. */
  169. private $sitemap;
  170. /**
  171. * @var string
  172. *
  173. * @ORM\Column(name="robots", type="string", length=255, nullable=true)
  174. */
  175. private $robots;
  176. /**
  177. * @var string
  178. *
  179. * @ORM\Column(name="type_editor", type="boolean", nullable=true)
  180. */
  181. private $typeEditor;
  182. /**
  183. * @var string
  184. *
  185. * @ORM\Column(name="canonical", type="string", length=500, nullable=true)
  186. */
  187. private $canonical;
  188. /**
  189. * @var string
  190. *
  191. * @ORM\Column(name="author", type="string", length=155, nullable=true)
  192. */
  193. private $author;
  194. /**
  195. * @var string
  196. *
  197. * @ORM\Column(name="url", type="string", length=500, nullable=true)
  198. */
  199. private $url;
  200. /**
  201. * @var string
  202. *
  203. * @ORM\Column(name="cta_html", type="text", nullable=true)
  204. */
  205. private $ctaHTML;
  206. /**
  207. * @var string
  208. *
  209. * @ORM\Column(name="keyword", type="string", length=500, nullable=true)
  210. */
  211. private $keyword;
  212. /**
  213. * @var string
  214. *
  215. * @ORM\Column(name="pageslug", type="string", length=500, nullable=true)
  216. */
  217. private $pageslug;
  218. /**
  219. * @var string
  220. *
  221. * @ORM\Column(name="pageslug2", type="string", length=500, nullable=true)
  222. */
  223. private $pageslug2;
  224. /**
  225. * @var string
  226. *
  227. * @ORM\Column(name="pageslug3", type="string", length=500, nullable=true)
  228. */
  229. private $pageslug3;
  230. /**
  231. * @var string
  232. *
  233. * @ORM\Column(name="visibleArticles", type="boolean", nullable=true)
  234. */
  235. private $visibleArticles;
  236. /**
  237. * @var string
  238. *
  239. * @ORM\Column(name="onlyPage", type="boolean", nullable=true)
  240. */
  241. private $onlyPage;
  242. /**
  243. * @var string
  244. *
  245. * @ORM\Column(name="identifiant", type="string", length=500, nullable=true)
  246. */
  247. private $identifiant;
  248. public function __construct() {
  249. $this->image = new \Vich\UploaderBundle\Entity\File();
  250. }
  251. /**
  252. * @ORM\PrePersist
  253. */
  254. public function setCreatedAtValue(): void {
  255. $this->setCreatedAt(new \DateTime("now"));
  256. $this->setUpdatedAt(new \DateTime("now"));
  257. $this->visibility = false;
  258. $this->featured = false;
  259. $this->carousel = false;
  260. $this->sitemap = true;
  261. $this->robots = "index,follow";
  262. $this->typeEditor = "classic";
  263. }
  264. /**
  265. * @ORM\PreUpdate
  266. */
  267. public function setUpdatedAtValue(): void {
  268. $this->setUpdatedAt(new \DateTime("now"));
  269. }
  270. public function __toString()
  271. {
  272. return $this->name;
  273. }
  274. /**
  275. * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  276. * of 'UploadedFile' is injected into this setter to trigger the update. If this
  277. * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  278. * must be able to accept an instance of 'File' as the bundle will inject one here
  279. * during Doctrine hydration.
  280. *
  281. * @param File|UploadedFile|null $imageFile
  282. */
  283. public function setImageFile(?File $imageFile = null)
  284. {
  285. $this->imageFile = $imageFile;
  286. if (null !== $imageFile) {
  287. // It is required that at least one field changes if you are using doctrine
  288. // otherwise the event listeners won't be called and the file is lost
  289. $this->setUpdatedAt(new \DateTime("now"));
  290. }
  291. }
  292. public function getImageFile(): ?File
  293. {
  294. return $this->imageFile;
  295. }
  296. public function setImage(EmbeddedFile $image): void
  297. {
  298. $this->image = $image;
  299. }
  300. public function getImage(): ?EmbeddedFile
  301. {
  302. return $this->image;
  303. }
  304. public function getId(): ?int
  305. {
  306. return $this->id;
  307. }
  308. public function getCreatedAt(): ?\DateTimeInterface
  309. {
  310. return $this->createdAt;
  311. }
  312. public function setCreatedAt(?\DateTimeInterface $createdAt): self
  313. {
  314. $this->createdAt = $createdAt;
  315. return $this;
  316. }
  317. public function getUpdatedAt(): ?\DateTimeInterface
  318. {
  319. return $this->updatedAt;
  320. }
  321. public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
  322. {
  323. $this->updatedAt = $updatedAt;
  324. return $this;
  325. }
  326. public function getPublishedAt(): ?\DateTimeInterface
  327. {
  328. return $this->publishedAt;
  329. }
  330. public function setPublishedAt(?\DateTimeInterface $publishedAt): self
  331. {
  332. $this->publishedAt = $publishedAt;
  333. return $this;
  334. }
  335. public function getSlug(): ?string
  336. {
  337. return $this->slug;
  338. }
  339. public function setSlug(?string $slug): self
  340. {
  341. $this->slug = $slug;
  342. return $this;
  343. }
  344. public function getTitle(): ?string
  345. {
  346. return $this->title;
  347. }
  348. public function setTitle(?string $title): self
  349. {
  350. $this->title = $title;
  351. return $this;
  352. }
  353. public function getShortTitle(): ?string
  354. {
  355. return $this->shortTitle;
  356. }
  357. public function setShortTitle(?string $shortTitle): self
  358. {
  359. $this->shortTitle = $shortTitle;
  360. return $this;
  361. }
  362. public function getSubtitle(): ?string
  363. {
  364. return $this->subtitle;
  365. }
  366. public function setSubtitle(?string $subtitle): self
  367. {
  368. $this->subtitle = $subtitle;
  369. return $this;
  370. }
  371. public function getType(): ?string
  372. {
  373. return $this->type;
  374. }
  375. public function setType(?string $type): self
  376. {
  377. $this->type = $type;
  378. return $this;
  379. }
  380. public function getShortDescription(): ?string
  381. {
  382. return $this->shortDescription;
  383. }
  384. public function setShortDescription(?string $shortDescription): self
  385. {
  386. $this->shortDescription = $shortDescription;
  387. return $this;
  388. }
  389. public function getDescription(): ?string
  390. {
  391. return $this->description;
  392. }
  393. public function setDescription(?string $description): self
  394. {
  395. $this->description = $description;
  396. return $this;
  397. }
  398. public function getDescriptionStart(): ?string
  399. {
  400. return $this->descriptionStart;
  401. }
  402. public function setDescriptionStart(?string $descriptionStart): self
  403. {
  404. $this->descriptionStart = $descriptionStart;
  405. return $this;
  406. }
  407. public function getTags(): ?string
  408. {
  409. return $this->tags;
  410. }
  411. public function setTags(?string $tags): self
  412. {
  413. $this->tags = $tags;
  414. return $this;
  415. }
  416. public function getVisibility(): ?bool
  417. {
  418. return $this->visibility;
  419. }
  420. public function setVisibility(?bool $visibility): self
  421. {
  422. $this->visibility = $visibility;
  423. return $this;
  424. }
  425. public function getLanguage(): ?string
  426. {
  427. return $this->language;
  428. }
  429. public function setLanguage(?string $language): self
  430. {
  431. $this->language = $language;
  432. return $this;
  433. }
  434. public function getCarousel(): ?bool
  435. {
  436. return $this->carousel;
  437. }
  438. public function setCarousel(?bool $carousel): self
  439. {
  440. $this->carousel = $carousel;
  441. return $this;
  442. }
  443. public function getFeatured(): ?bool
  444. {
  445. return $this->featured;
  446. }
  447. public function setFeatured(?bool $featured): self
  448. {
  449. $this->featured = $featured;
  450. return $this;
  451. }
  452. public function getAutopublishedAt(): ?\DateTimeInterface
  453. {
  454. return $this->autopublishedAt;
  455. }
  456. public function setAutopublishedAt(?\DateTimeInterface $autopublishedAt): self
  457. {
  458. $this->autopublishedAt = $autopublishedAt;
  459. return $this;
  460. }
  461. public function getTranslation(): ?string
  462. {
  463. return $this->translation;
  464. }
  465. public function setTranslation(?string $translation): self
  466. {
  467. $this->translation = $translation;
  468. return $this;
  469. }
  470. public function getSitemap(): ?bool
  471. {
  472. return $this->sitemap;
  473. }
  474. public function setSitemap(?bool $sitemap): self
  475. {
  476. $this->sitemap = $sitemap;
  477. return $this;
  478. }
  479. public function getRobots(): ?string
  480. {
  481. return $this->robots;
  482. }
  483. public function setRobots(?string $robots): self
  484. {
  485. $this->robots = $robots;
  486. return $this;
  487. }
  488. public function getTypeEditor(): ?bool
  489. {
  490. return $this->typeEditor;
  491. }
  492. public function setTypeEditor(?bool $typeEditor): self
  493. {
  494. $this->typeEditor = $typeEditor;
  495. return $this;
  496. }
  497. public function getCanonical(): ?string
  498. {
  499. return $this->canonical;
  500. }
  501. public function setCanonical(?string $canonical): self
  502. {
  503. $this->canonical = $canonical;
  504. return $this;
  505. }
  506. public function getAuthor(): ?string
  507. {
  508. return $this->author;
  509. }
  510. public function setAuthor(?string $author): self
  511. {
  512. $this->author = $author;
  513. return $this;
  514. }
  515. public function getUrl(): ?string
  516. {
  517. return $this->url;
  518. }
  519. public function setUrl(?string $url): self
  520. {
  521. $this->url = $url;
  522. return $this;
  523. }
  524. public function getCtaHTML(): ?string
  525. {
  526. return $this->ctaHTML;
  527. }
  528. public function setCtaHTML(?string $ctaHTML): self
  529. {
  530. $this->ctaHTML = $ctaHTML;
  531. return $this;
  532. }
  533. public function isVisibility(): ?bool
  534. {
  535. return $this->visibility;
  536. }
  537. public function isCarousel(): ?bool
  538. {
  539. return $this->carousel;
  540. }
  541. public function isFeatured(): ?bool
  542. {
  543. return $this->featured;
  544. }
  545. public function isSitemap(): ?bool
  546. {
  547. return $this->sitemap;
  548. }
  549. public function isTypeEditor(): ?bool
  550. {
  551. return $this->typeEditor;
  552. }
  553. public function getKeyword(): ?string
  554. {
  555. return $this->keyword;
  556. }
  557. public function setKeyword(?string $keyword): static
  558. {
  559. $this->keyword = $keyword;
  560. return $this;
  561. }
  562. public function getPageslug(): ?string
  563. {
  564. return $this->pageslug;
  565. }
  566. public function setPageslug(?string $pageslug): static
  567. {
  568. $this->pageslug = $pageslug;
  569. return $this;
  570. }
  571. public function getPageslug2(): ?string
  572. {
  573. return $this->pageslug2;
  574. }
  575. public function setPageslug2(?string $pageslug2): static
  576. {
  577. $this->pageslug2 = $pageslug2;
  578. return $this;
  579. }
  580. public function getPageslug3(): ?string
  581. {
  582. return $this->pageslug3;
  583. }
  584. public function setPageslug3(?string $pageslug3): static
  585. {
  586. $this->pageslug3 = $pageslug3;
  587. return $this;
  588. }
  589. public function isVisibleArticles(): ?bool
  590. {
  591. return $this->visibleArticles;
  592. }
  593. public function setVisibleArticles(?bool $visibleArticles): static
  594. {
  595. $this->visibleArticles = $visibleArticles;
  596. return $this;
  597. }
  598. public function isOnlyPage(): ?bool
  599. {
  600. return $this->onlyPage;
  601. }
  602. public function setOnlyPage(?bool $onlyPage): static
  603. {
  604. $this->onlyPage = $onlyPage;
  605. return $this;
  606. }
  607. public function getTitleAriane(): ?string
  608. {
  609. return $this->titleAriane;
  610. }
  611. public function setTitleAriane(?string $titleAriane): static
  612. {
  613. $this->titleAriane = $titleAriane;
  614. return $this;
  615. }
  616. public function getIdentifiant(): ?string
  617. {
  618. return $this->identifiant;
  619. }
  620. public function setIdentifiant(?string $titleAriane): static
  621. {
  622. $this->identifiant = $titleAriane;
  623. return $this;
  624. }
  625. }