src/Entity/Core/ActivityFolder.php line 14

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity\Core;
  4. use App\Entity\User\User;
  5. use DateTime;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. #[ORM\Table(name: 'activity_folder')]
  10. #[ORM\Entity(repositoryClass: ActivityFolderRepository::class)]
  11. class ActivityFolder
  12. {
  13. public const int TYPE_SYSTEM_FOLDER = 1;
  14. public const int TYPE_USER_FOLDER = 2;
  15. #[ORM\Id]
  16. #[ORM\GeneratedValue]
  17. #[ORM\Column(type: 'integer')]
  18. private int $id;
  19. #[ORM\Column(type: 'string', length: 255)]
  20. private string $name;
  21. #[ORM\OneToMany(targetEntity: RelationActivityFolderActivity::class, mappedBy: 'activityFolder')]
  22. private Collection $relationActivities;
  23. #[ORM\JoinColumn(name: 'created_by', referencedColumnName: 'id', nullable: true)]
  24. #[ORM\ManyToOne(targetEntity: User::class)]
  25. private ?User $createdBy = null;
  26. #[ORM\Column(type: 'boolean', name: 'is_template', options: ['default' => true])]
  27. private bool $isTemplate = true;
  28. #[ORM\Column(type: 'datetime', nullable: true, options: ['comment' => 'Timestamp when the folder was marked as deleted'])]
  29. private ?DateTime $deleted = null;
  30. #[ORM\Column(type: 'string', length: 2000, nullable: true)]
  31. private ?string $description = null;
  32. public function __construct()
  33. {
  34. $this->relationActivities = new ArrayCollection();
  35. }
  36. public function getId(): int
  37. {
  38. return $this->id;
  39. }
  40. public function getName(): string
  41. {
  42. return $this->name;
  43. }
  44. /**
  45. * @return $this
  46. */
  47. public function setName(string $name): self
  48. {
  49. $this->name = $name;
  50. return $this;
  51. }
  52. public function getRelationActivities(): Collection
  53. {
  54. return $this->relationActivities;
  55. }
  56. /**
  57. * @return $this
  58. */
  59. public function addRelationActivity(RelationActivityFolderActivity $relationActivity): self
  60. {
  61. if (!$this->relationActivities->contains($relationActivity)) {
  62. $this->relationActivities[] = $relationActivity;
  63. $relationActivity->setActivityFolder($this);
  64. }
  65. return $this;
  66. }
  67. /**
  68. * @return $this
  69. */
  70. public function removeRelationActivity(RelationActivityFolderActivity $relationActivity): self
  71. {
  72. if ($this->relationActivities->removeElement($relationActivity)) {
  73. // set the owning side to null (unless already changed)
  74. if ($relationActivity->getActivityFolder() === $this) {
  75. $relationActivity->setActivityFolder(null);
  76. }
  77. }
  78. return $this;
  79. }
  80. public function getCreatedBy(): ?User
  81. {
  82. return $this->createdBy;
  83. }
  84. /**
  85. * @return $this
  86. */
  87. public function setCreatedBy(?User $createdBy): self
  88. {
  89. $this->createdBy = $createdBy;
  90. return $this;
  91. }
  92. public function isTemplate(): bool
  93. {
  94. return $this->isTemplate;
  95. }
  96. /**
  97. * @return $this
  98. */
  99. public function setIsTemplate(bool $isTemplate): self
  100. {
  101. $this->isTemplate = $isTemplate;
  102. return $this;
  103. }
  104. public function getDeleted(): ?DateTime
  105. {
  106. return $this->deleted;
  107. }
  108. /**
  109. * @param ?DateTime $deleted
  110. * @return $this
  111. */
  112. public function setDeleted(?DateTime $deleted): self
  113. {
  114. $this->deleted = $deleted;
  115. return $this;
  116. }
  117. public function isDeleted(): bool
  118. {
  119. return !($this->deleted === null);
  120. }
  121. public function getDescription(): ?string
  122. {
  123. return $this->description;
  124. }
  125. /**
  126. * @return $this
  127. */
  128. public function setDescription(?string $description): self
  129. {
  130. $this->description = $description;
  131. return $this;
  132. }
  133. }