Skip to content

Instantly share code, notes, and snippets.

@PhazeonPhoenix
Created March 13, 2012 23:13
Show Gist options
  • Save PhazeonPhoenix/2032519 to your computer and use it in GitHub Desktop.
Save PhazeonPhoenix/2032519 to your computer and use it in GitHub Desktop.
Symfony: Normal Controller
<?php
namespace Acme\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Cache;
use JMS\SecurityExtraBundle\Annotation\Secure;
use JMS\SecurityExtraBundle\Annotation\SecureParam;
use JMS\SecurityExtraBundle\Annotation\SecureReturn;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class DefaultController extends Controller
{
/**
* @Route("/", name="homepage")
* @Method({"GET","POST"})
* @Template()
* @Cache(expires="tomorrow")
*/
public function indexAction(Request $request)
{
$name = 'Bob Dole'
return array('name' => $name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment