Advertisement
Guest User

Untitled

a guest
Jun 13th, 2018
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.93 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Entity;
  4.  
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\Common\Collections\Criteria;
  8. use Doctrine\ORM\Mapping as ORM;
  9.  
  10. /**
  11. * @ORM\Entity(repositoryClass="App\Repository\ForumForumRepository")
  12. */
  13. class ForumForum
  14. {
  15. /**
  16. * @ORM\Id()
  17. * @ORM\GeneratedValue()
  18. * @ORM\Column(type="integer")
  19. */
  20. private $id;
  21.  
  22. /**
  23. * @ORM\Column(type="string", length=255)
  24. */
  25. private $title;
  26.  
  27. /**
  28. * @ORM\Column(type="integer")
  29. */
  30. private $pos;
  31.  
  32. /**
  33. * @ORM\Column(type="string", length=255, nullable=true)
  34. */
  35. private $description;
  36.  
  37. /**
  38. * @ORM\ManyToOne(targetEntity="App\Entity\forumCat", inversedBy="forumForums")
  39. * @ORM\JoinColumn(nullable=false)
  40. */
  41. private $cat;
  42.  
  43. /**
  44. * @ORM\OneToMany(targetEntity="App\Entity\ForumTopics", mappedBy="forum")
  45. */
  46. private $forumTopics;
  47.  
  48. public function __construct()
  49. {
  50. $this->forumTopics = new ArrayCollection();
  51. }
  52.  
  53. public function getId()
  54. {
  55. return $this->id;
  56. }
  57.  
  58. public function getTitle(): ?string
  59. {
  60. return $this->title;
  61. }
  62.  
  63. public function setTitle(string $title): self
  64. {
  65. $this->title = $title;
  66.  
  67. return $this;
  68. }
  69.  
  70. public function getPos(): ?int
  71. {
  72. return $this->pos;
  73. }
  74.  
  75. public function setPos(int $pos): self
  76. {
  77. $this->pos = $pos;
  78.  
  79. return $this;
  80. }
  81.  
  82. public function getDescription(): ?string
  83. {
  84. return $this->description;
  85. }
  86.  
  87. public function setDescription(?string $description): self
  88. {
  89. $this->description = $description;
  90.  
  91. return $this;
  92. }
  93.  
  94. public function getCat(): ?forumCat
  95. {
  96. return $this->cat;
  97. }
  98.  
  99. public function setCat(?forumCat $cat): self
  100. {
  101. $this->cat = $cat;
  102.  
  103. return $this;
  104. }
  105.  
  106. // public function getLastTopic()
  107. // {
  108. // return $this->forumTopics->matching($criteria);
  109. // }
  110.  
  111. /**
  112. * @return Collection|ForumTopics[]
  113. */
  114. public function getForumTopics(): Collection
  115. {
  116. return $this->forumTopics;
  117. }
  118.  
  119. public function addForumTopic(ForumTopics $forumTopic): self
  120. {
  121. if (!$this->forumTopics->contains($forumTopic)) {
  122. $this->forumTopics[] = $forumTopic;
  123. $forumTopic->setForum($this);
  124. }
  125.  
  126. return $this;
  127. }
  128.  
  129. public function removeForumTopic(ForumTopics $forumTopic): self
  130. {
  131. if ($this->forumTopics->contains($forumTopic)) {
  132. $this->forumTopics->removeElement($forumTopic);
  133. // set the owning side to null (unless already changed)
  134. if ($forumTopic->getForum() === $this) {
  135. $forumTopic->setForum(null);
  136. }
  137. }
  138.  
  139. return $this;
  140. }
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement