Skip to content

Instantly share code, notes, and snippets.

@trq
Created June 2, 2014 05:57
Show Gist options
  • Save trq/eb6243d0a59652d03bbc to your computer and use it in GitHub Desktop.
Save trq/eb6243d0a59652d03bbc to your computer and use it in GitHub Desktop.
<?php
namespace Foo\SiteBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
class CmsController implements ContainerAwareInterface
{
private $container;
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
public function dynamicAction(Request $request)
{
if ($request->attributes->has('_entity')) {
$page = $request->attributes->get('_entity');
return $this->render($page->getTemplate(), $page);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment