kekrozsak/src/KekRozsak/FrontBundle/Entity/ForumTopic.php

239 lines
3.6 KiB
PHP
Raw Normal View History

<?php
namespace KekRozsak\FrontBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
2012-07-15 12:56:31 +00:00
use Doctrine\Common\Collections\ArrayCollection;
2012-07-15 12:56:31 +00:00
use KekRozsak\SecurityBundle\Entity\User;
/**
* @ORM\Entity
2012-07-15 12:56:31 +00:00
* @ORM\Table(name="forum_topics")
*/
class ForumTopic
{
public function __construct()
{
2012-07-15 12:56:31 +00:00
$this->posts = new ArrayCollection();
}
/**
* @var integer $id
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* @ORM\Column(type="integer")
*/
protected $id;
/**
* Get id
*
2012-07-15 12:56:31 +00:00
* @return integer
*/
public function getId()
{
2012-07-15 12:56:31 +00:00
return $this->id;
}
/**
2012-07-15 12:56:31 +00:00
* @var KekRozsak\SecurityBundle\Entity\User $createdBy
* @ORM\ManyToOne(targetEntity="KekRozsak\SecurityBundle\Entity\User")
* @ORM\JoinColumn(name="created_by_id")
*/
protected $createdBy;
/**
2012-07-15 12:56:31 +00:00
* Set createdBy
*
2012-07-15 12:56:31 +00:00
* @param KekRozsak\SecurityBundle\Entity\User
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setCreatedBy(\KekRozsak\SecurityBundle\Entity\User $createdBy)
{
2012-07-15 12:56:31 +00:00
$this->createdBy = $createdBy;
return $this;
}
/**
2012-07-15 12:56:31 +00:00
* Get createdBy
*
2012-07-15 12:56:31 +00:00
* @return KekRozsak\SecurityBundle\Entity\User
*/
2012-07-15 12:56:31 +00:00
public function getCreatedBy()
{
2012-07-15 12:56:31 +00:00
return $this->createdBy;
}
/**
2012-07-15 12:56:31 +00:00
* @var DateTime $createdAt
* @ORM\Column(type="datetime", nullable=false, name="created_at")
*/
protected $createdAt;
/**
* Set createdAt
*
* @param DateTime $createdAt
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
2012-07-15 12:56:31 +00:00
* @return DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
2012-07-15 12:56:31 +00:00
* @var ForumTopicGroup $topicGroup
* @ORM\ManyToOne(targetEntity="ForumTopicGroup", inversedBy="topics")
* @ORM\JoinColumn(name="topic_group_id")
*/
protected $topicGroup;
/**
2012-07-15 12:56:31 +00:00
* Set topicGroup
*
2012-07-15 12:56:31 +00:00
* @param ForumTopicGroup $topicGroup
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setTopicGroup(ForumTopicGroup $topicGroup)
{
2012-07-15 12:56:31 +00:00
$this->topicGroup = $topicGroup;
return $this;
}
/**
2012-07-15 12:56:31 +00:00
* Get topicGroup
*
2012-07-15 12:56:31 +00:00
* @return ForumTopicGroup
*/
2012-07-15 12:56:31 +00:00
public function getTopicGroup()
{
2012-07-15 12:56:31 +00:00
return $this->topicGroup;
}
/**
2012-07-15 12:56:31 +00:00
* @var string $slug
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $slug;
/**
2012-07-15 12:56:31 +00:00
* Set slug
*
2012-07-15 12:56:31 +00:00
* @param string $slug
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setSlug($slug)
{
2012-07-15 12:56:31 +00:00
$this->slug = $slug;
return $this;
}
/**
2012-07-15 12:56:31 +00:00
* Get slug
*
2012-07-15 12:56:31 +00:00
* @return string
*/
2012-07-15 12:56:31 +00:00
public function getSlug()
{
2012-07-15 12:56:31 +00:00
return $this->slug;
}
/**
2012-07-15 12:56:31 +00:00
* @var string $title
* @ORM\Column(type="string", length=100, nullable=false)
*/
protected $title;
/**
2012-07-15 12:56:31 +00:00
* Set title
*
2012-07-15 12:56:31 +00:00
* @param string $title
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setTitle($title)
{
2012-07-15 12:56:31 +00:00
$this->title = $title;
return $this;
}
/**
2012-07-15 12:56:31 +00:00
* Get title
*
2012-07-15 12:56:31 +00:00
* @return string
*/
2012-07-15 12:56:31 +00:00
public function getTitle()
{
2012-07-15 12:56:31 +00:00
return $this->title;
}
/**
2012-07-15 12:56:31 +00:00
* @var ForumPost $lastPost
* @ORM\OneToOne(targetEntity="ForumPost", cascade={"persist"})
* @ORM\JoinColumn(name="last_post_id")
*/
protected $lastPost;
/**
2012-07-15 12:56:31 +00:00
* Set lastPost
*
2012-07-15 12:56:31 +00:00
* @param ForumPost $lastPost
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function setLastPost($lastPost = null)
{
2012-07-15 12:56:31 +00:00
$this->lastPost = $lastPost;
}
/**
2012-07-15 12:56:31 +00:00
* Get lastPost
*
2012-07-15 12:56:31 +00:00
* @return ForumPost
*/
2012-07-15 12:56:31 +00:00
public function getLastPost()
{
2012-07-15 12:56:31 +00:00
return $this->lastPost;
}
/**
2012-07-15 12:56:31 +00:00
* @var ArrayCollection $topics;
* @ORM\OneToMany(targetEntity="ForumPost", mappedBy="topic")
*/
protected $posts;
/**
2012-07-15 12:56:31 +00:00
* Add post
*
2012-07-15 12:56:31 +00:00
* @param ForumPost $post
* @return ForumTopic
*/
2012-07-15 12:56:31 +00:00
public function addPost(ForumPost $post)
{
2012-07-15 12:56:31 +00:00
$this->posts[] = $post;
return $this;
}
/**
* Get posts
*
2012-07-15 12:56:31 +00:00
* @return ArrayCollection
*/
public function getPosts()
{
return $this->posts;
}
}
2012-07-15 12:56:31 +00:00