src/Entity/Scholar/Chapter/OriginChapter.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Scholar\Chapter;
  3. use App\Entity\Scholar\Indexed\IndexedContent;
  4. use App\Entity\Scholar\LinksDTOTrait;
  5. use App\Repository\Scholar\OriginChapterRepository;
  6. use App\Validator\Constraints as AcmeAssert;
  7. use Doctrine\Common\Collections\Collection;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. #[ORM\Table(name: 'scholar_origin_chapters')]
  11. #[ORM\Entity(repositoryClass: OriginChapterRepository::class)]
  12. class OriginChapter extends Chapter
  13. {
  14. use LinksDTOTrait;
  15. #[ORM\Column(type: 'string', length: 255)]
  16. #[
  17. Assert\NotBlank(message: 'scholar.chapter.name.NotBlank'),
  18. Assert\Length(
  19. min: 2,
  20. max: 255,
  21. minMessage: 'scholar.chapter.name.Length.min',
  22. maxMessage: 'scholar.chapter.name.Length.max',
  23. ),
  24. AcmeAssert\HtmlTagConstraint
  25. ]
  26. private ?string $name = null;
  27. #[ORM\Column(type: 'text')]
  28. #[
  29. Assert\NotBlank(message: 'scholar.chapter.body.NotBlank'),
  30. AcmeAssert\HtmlTagConstraint(),
  31. ]
  32. private ?string $body = null;
  33. #[ORM\Column(name: 'sort_order', type: 'integer')]
  34. private ?int $order = null;
  35. #[ORM\Column(type: 'text', nullable: true)]
  36. private ?string $description;
  37. #[ORM\OneToMany(mappedBy: 'lockBy', targetEntity: SharedChapter::class, cascade: ['remove'], fetch: 'EXTRA_LAZY', orphanRemoval: true)]
  38. private ?Collection $sharedChapters;
  39. #[ORM\OneToOne(targetEntity: IndexedContent::class, cascade: ['remove', 'persist'], orphanRemoval: true)]
  40. private ?IndexedContent $indexedContent;
  41. public function isIndexed(): bool
  42. {
  43. return $this->getIndexedContent()?->getUuid() !== null;
  44. }
  45. public function getIndexedContent(): ?IndexedContent
  46. {
  47. return $this->indexedContent;
  48. }
  49. public function getName(): ?string
  50. {
  51. return $this->name;
  52. }
  53. public function setName(?string $name): static
  54. {
  55. $this->name = $name;
  56. return $this;
  57. }
  58. public function getBody(): ?string
  59. {
  60. return $this->body;
  61. }
  62. public function setBody(?string $body): static
  63. {
  64. $this->body = $body;
  65. return $this;
  66. }
  67. public function getDescription(): ?string
  68. {
  69. return $this->description;
  70. }
  71. public function setDescription(?string $description): self
  72. {
  73. $this->description = $description;
  74. return $this;
  75. }
  76. public function getOrder(): ?int
  77. {
  78. return $this->order;
  79. }
  80. public function setOrder(?int $order): static
  81. {
  82. $this->order = $order;
  83. return $this;
  84. }
  85. public function getSharedChapters(): ?Collection
  86. {
  87. return $this->sharedChapters;
  88. }
  89. public function setSharedChapters(?Collection $sharedChapters): OriginChapter
  90. {
  91. $this->sharedChapters = $sharedChapters;
  92. return $this;
  93. }
  94. public function setIndexedContent(?IndexedContent $indexedContent): OriginChapter
  95. {
  96. $this->indexedContent = $indexedContent;
  97. return $this;
  98. }
  99. }