diff src/Kachkaev/JstmplBundle/Controller/JstmplController.php @ 0:493bcb69166c

added public content
author Daniel Wolff
date Tue, 09 Feb 2016 20:54:02 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Kachkaev/JstmplBundle/Controller/JstmplController.php	Tue Feb 09 20:54:02 2016 +0100
@@ -0,0 +1,23 @@
+<?php
+
+namespace Kachkaev\JstmplBundle\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+
+class JstmplController extends Controller
+{
+    public function indexAction($name)
+    {
+        foreach ($this->container->getParameter('jstmpl.source.patterns') as $v) {
+            try {
+                $response = $this->render(str_replace('{name}',$name, $v));
+                return $response;
+            } catch (\InvalidArgumentException $e) {
+            }
+        }
+
+        throw new NotFoundHttpException();
+    }
+}
\ No newline at end of file