Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Acme\TestBundle\Controller;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
- use Symfony\Component\HttpFoundation\Response;
- use Symfony\Component\HttpFoundation\JsonResponse;
- class HoiWorldController extends Controller {
- /**
- * @Route("/hoi/{msg}", name="acme_hoi")
- */
- public function greatingAction($msg)
- {
- $html = $this->container
- ->get('templating')
- ->render(
- 'AcmeTestBundle:Hoi:hoi.html.twig',
- array('msg' => $msg)
- );
- return new Response($html);
- }
- /**
- * @Route("/hoi2/{msg}", name="acme_hoi2")
- */
- public function greating2Action($msg)
- {
- return $this->render('AcmeTestBundle:Hoi:hoi.html.twig', array('msg' => $msg) );
- }
- /**
- * Hanya redirect / Just redirect to acme_hoi2
- * @Route("/hoi3/{msg}", name="acme_hoi3")
- */
- public function greating3Action($msg)
- {
- return $this->redirectToRoute('acme_hoi2', ['msg' => $msg ] ); // > 2.6 only
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement