point-tools/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php

380 lines
6.4 KiB
PHP
Raw Normal View History

<?php
namespace Skobkin\Bundle\PointToolsBundle\Entity\Blogs;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Skobkin\Bundle\PointToolsBundle\Entity\User;
/**
* Comment
*
* @ORM\Table(name="comments", schema="posts", indexes={
* @ORM\Index(name="idx_comment_created_at", columns={"created_at"})
* })
* @ORM\Entity
*/
class Comment
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="text", type="text")
*/
private $text;
/**
* @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
*/
private $createdAt;
/**
* @var boolean
*
* @ORM\Column(name="is_rec", type="boolean")
*/
private $rec;
/**
* @var bool
*
* @ORM\Column(name="is_deleted", type="boolean")
*/
private $deleted = false;
/**
* @var Post
*
* @ORM\ManyToOne(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Post", inversedBy="comments")
* @ORM\JoinColumn(name="post_id")
*/
private $post;
/**
* @var int
*
* @ORM\Column(name="number", type="smallint")
*/
private $number;
/**
* @var User
*
* @ORM\ManyToOne(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\User", fetch="EAGER")
* @ORM\JoinColumn(name="author_id")
*/
private $author;
/**
* @var File[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\File", fetch="EXTRA_LAZY", cascade={"persist"})
* @ORM\JoinTable(name="comments_files", schema="posts",
* joinColumns={@ORM\JoinColumn(name="comment_id")},
* inverseJoinColumns={@ORM\JoinColumn(name="file_id")}
* )
*/
private $files;
/**
* @var Comment|null
*
* @ORM\ManyToOne(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Comment", inversedBy="children")
* @ORM\JoinColumn(name="parent_id", nullable=true)
*/
private $parent;
/**
2016-12-12 18:02:19 +00:00
* @var Comment[]|ArrayCollection
*
* @ORM\OneToMany(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\Comment", fetch="EXTRA_LAZY", mappedBy="parent")
*/
private $children;
public function __construct()
{
$this->files = new ArrayCollection();
$this->children = new ArrayCollection();
}
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
* @return Comment
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set text
*
* @param string $text
* @return Comment
*/
public function setText($text)
{
$this->text = $text;
return $this;
}
/**
* Get text
*
* @return string
*/
public function getText()
{
return $this->text;
}
/**
* Set isRec
*
* @param boolean $rec
* @return Comment
*/
public function setRec($rec)
{
$this->rec = $rec;
return $this;
}
/**
* Get isRec
*
* @return boolean
*/
public function isRec()
{
return $this->rec;
}
/**
* Get isRec
*
* @return boolean
*/
public function getRec()
{
return $this->rec;
}
/**
* @return Post
*/
public function getPost()
{
return $this->post;
}
/**
* @param Post $post
* @return Comment
*/
public function setPost($post)
{
$this->post = $post;
return $this;
}
/**
* Set number
*
* @param int $number
* @return Comment
*/
public function setNumber($number)
{
$this->number = $number;
return $this;
}
/**
* Get number
*
* @return int
*/
public function getNumber()
{
return $this->number;
}
/**
* @return User
*/
public function getAuthor()
{
return $this->author;
}
/**
* @param User $author
* @return Comment
*/
public function setAuthor($author)
{
$this->author = $author;
return $this;
}
/**
* Add files
*
* @param File $files
* @return Comment
*/
public function addFile(File $files)
{
$this->files[] = $files;
return $this;
}
/**
* Remove files
*
* @param File $files
*/
public function removeFile(File $files)
{
$this->files->removeElement($files);
}
/**
* Get files
*
* @return File[]|ArrayCollection
*/
public function getFiles()
{
return $this->files;
}
/**
* @return Comment
*/
public function getParent()
{
return $this->parent;
}
/**
* @param Comment $parent
* @return Comment
*/
public function setParent($parent)
{
$this->parent = $parent;
return $this;
}
/**
* Set deleted
*
* @param boolean $deleted
* @return Comment
*/
public function setDeleted($deleted)
{
$this->deleted = $deleted;
return $this;
}
/**
* Get deleted
*
* @return boolean
*/
public function getDeleted()
{
return $this->deleted;
}
/**
* Get deleted
*
* @return boolean
*/
public function isDeleted()
{
return $this->deleted;
}
/**
* Add children
*
* @param Comment $children
* @return Comment
*/
public function addChild(Comment $children)
{
$this->children[] = $children;
return $this;
}
/**
* Remove children
*
* @param Comment $children
*/
public function removeChild(Comment $children)
{
$this->children->removeElement($children);
}
/**
* Get children
*
2016-12-12 18:02:19 +00:00
* @return Comment[]|ArrayCollection
*/
public function getChildren()
{
return $this->children;
}
}