Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Entity;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- /**
- * @ORM\Entity(repositoryClass="App\Repository\ForumTopicsRepository")
- */
- class ForumTopics
- {
- /**
- * @ORM\Id()
- * @ORM\GeneratedValue()
- * @ORM\Column(type="integer")
- */
- private $id;
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $title;
- /**
- * @ORM\ManyToOne(targetEntity="App\Entity\forumForum", inversedBy="forumTopics")
- * @ORM\JoinColumn(nullable=false)
- */
- private $forum;
- /**
- * @ORM\OneToMany(targetEntity="App\Entity\ForumPosts", mappedBy="topic")
- */
- private $forumPosts;
- public function __construct()
- {
- $this->forumPosts = new ArrayCollection();
- }
- public function getId()
- {
- return $this->id;
- }
- public function getTitle(): ?string
- {
- return $this->title;
- }
- public function setTitle(string $title): self
- {
- $this->title = $title;
- return $this;
- }
- public function getForum(): ?forumForum
- {
- return $this->forum;
- }
- public function setForum(?forumForum $forum): self
- {
- $this->forum = $forum;
- return $this;
- }
- /**
- * @return Collection|ForumPosts[]
- */
- public function getForumPosts(): Collection
- {
- return $this->forumPosts;
- }
- public function addForumPost(ForumPosts $forumPost): self
- {
- if (!$this->forumPosts->contains($forumPost)) {
- $this->forumPosts[] = $forumPost;
- $forumPost->setTopic($this);
- }
- return $this;
- }
- public function removeForumPost(ForumPosts $forumPost): self
- {
- if ($this->forumPosts->contains($forumPost)) {
- $this->forumPosts->removeElement($forumPost);
- // set the owning side to null (unless already changed)
- if ($forumPost->getTopic() === $this) {
- $forumPost->setTopic(null);
- }
- }
- return $this;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement