Added the Taggable interface to blog posts
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
@@ -7,6 +7,7 @@ use Gedmo\Mapping\Annotation as GedmoORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use DoctrineExtensions\Taggable\Taggable;
|
||||
|
||||
use GergelyPolonkai\FrontBundle\Entity\Comment;
|
||||
use GergelyPolonkai\FrontBundle\Entity\User;
|
||||
@@ -19,7 +20,7 @@ use GergelyPolonkai\FrontBundle\Entity\User;
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="blog_posts")
|
||||
*/
|
||||
class Post
|
||||
class Post implements Taggable
|
||||
{
|
||||
/**
|
||||
* @var integer $id
|
||||
@@ -86,6 +87,8 @@ class Post
|
||||
*/
|
||||
private $comments;
|
||||
|
||||
private $tags;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
@@ -273,4 +276,21 @@ class Post
|
||||
{
|
||||
return $this->comments;
|
||||
}
|
||||
|
||||
public function getTags()
|
||||
{
|
||||
$this->tags = $this->tags ?: new ArrayCollection();
|
||||
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
public function getTaggableType()
|
||||
{
|
||||
return 'gergelypolonkaifront_post';
|
||||
}
|
||||
|
||||
public function getTaggableId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user