Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
namespace NewCoInc\AppBundle\Entity;
use Doctrine\ORM\EntityRepository;
class BlogRepository extends EntityRepository
{
public function getTags()
{
$blogTags = $this->createQueryBuilder('b')
->select('b.tags')
->getQuery()
->getResult();
$tags = array();
foreach ($blogTags as $blogTag)
{
$tags = array_merge(explode(",", $blogTag['tags']), $tags);
}
foreach ($tags as &$tag)
{
$tag = trim($tag);
}
return $tags;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment