Skip to content

Instantly share code, notes, and snippets.

@yuriteixeira
Created February 14, 2012 16:07
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 yuriteixeira/1827790 to your computer and use it in GitHub Desktop.
Save yuriteixeira/1827790 to your computer and use it in GitHub Desktop.
SF2, Doctrine and Caching
/**
* @param string $blockSlug
* @return \Rocket\BraPrintBundle\Entity\CmsBlock
*/
public function getBlock($blockSlug) {
$result = '';
$repo = $this->getEntityManager()->getRepository('RocketBraPrintBundle:CmsBlock');
$item = $repo->findOneBySlug($blockSlug);
if ($item instanceof CmsBlock) {
$result = $item->getContent();
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment