Skip to content

Instantly share code, notes, and snippets.

@chriskief
Created October 24, 2013 03:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriskief/7130755 to your computer and use it in GitHub Desktop.
Save chriskief/7130755 to your computer and use it in GitHub Desktop.
<?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