add route parameter
authorymh <ymh.work@gmail.com>
Thu, 27 Oct 2011 22:22:36 +0200
changeset 21 780ef37e63b9
parent 20 985f1992895d
child 22 99c15cfe420b
add route parameter
Controller/WikiTagController.php
DependencyInjection/Configuration.php
DependencyInjection/WikiTagExtension.php
--- a/Controller/WikiTagController.php	Thu Oct 27 21:37:34 2011 +0200
+++ b/Controller/WikiTagController.php	Thu Oct 27 22:22:36 2011 +0200
@@ -1,6 +1,6 @@
 <?php
 /*
- * This file is part of the WikiTagBundle package.
+* This file is part of the WikiTagBundle package.
 *
 * (c) IRI <http://www.iri.centrepompidou.fr/>
 *
@@ -26,7 +26,6 @@
 class WikiTagController extends Controller
 {
     private static $SEARCH_STAR_CHARACTER = "*";
-    private static $ROUTE_FOR_DOCUMENTS_BY_TAG = "company_other";
     
     /**
      * Fake index action
@@ -358,7 +357,7 @@
     }
     
     /**
-     * 
+     *
      * TODO: Enter description here ...
      * TODO : implement
      */
@@ -463,10 +462,10 @@
             $search_def[$l[0]] = $l[0].WikiTagController::$SEARCH_STAR_CHARACTER;
         }
         
-        return $this->render('WikiTagBundle:WikiTag:TagList.html.twig', 
-            array('tags' => $tags, 'searched' => $searched, 'search_def' => $search_def, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 
-            'start_index' => $start_index, 'end_index' => $end_index, 'nb_total' => $nb_total, 'num_page' => $num_page, 'last_page' => $last_page, 
-        	'prev_page' => $prev_page, 'next_page' => $next_page, 'reverse_sort' => $reverse_sort, 'route_for_documents_by_tag' => WikiTagController::$ROUTE_FOR_DOCUMENTS_BY_TAG));
+        return $this->render('WikiTagBundle:WikiTag:TagList.html.twig',
+            array('tags' => $tags, 'searched' => $searched, 'search_def' => $search_def, 'nb_by_page' => $nb_by_page, 'sort' => $sort,
+            'start_index' => $start_index, 'end_index' => $end_index, 'nb_total' => $nb_total, 'num_page' => $num_page, 'last_page' => $last_page,
+        	'prev_page' => $prev_page, 'next_page' => $next_page, 'reverse_sort' => $reverse_sort, 'route_for_documents_by_tag' => $this->container->getParameter("wiki_tag.route_for_documents_by_tag")));
     }
 
 
@@ -485,8 +484,8 @@
         $sort = $ar[4];
         $reverse_sort = $ar[5];
         
-        return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig', 
-            array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page, 
+        return $this->render('WikiTagBundle:WikiTag:TagListTable.html.twig',
+            array('tags' => $tags, 'searched' => $searched, 'nb_by_page' => $nb_by_page, 'sort' => $sort, 'num_page' => $num_page,
         	'reverse_sort' => $reverse_sort, 'route_for_documents_by_tag' => WikiTagController::$ROUTE_FOR_DOCUMENTS_BY_TAG));
         
         return $this->getAllTags();
--- a/DependencyInjection/Configuration.php	Thu Oct 27 21:37:34 2011 +0200
+++ b/DependencyInjection/Configuration.php	Thu Oct 27 22:22:36 2011 +0200
@@ -22,7 +22,8 @@
         
         $rootNode
             ->children()
-                ->scalarNode('document_class')->end()
+                ->scalarNode('route_for_documents_by_tag')->defaultNull()->end()
+                ->scalarNode('document_class')->isRequired()->end()
                 ->scalarNode('document_id_column')->defaultValue('id')->end()
             ->end()
             ->fixXmlConfig('field')
--- a/DependencyInjection/WikiTagExtension.php	Thu Oct 27 21:37:34 2011 +0200
+++ b/DependencyInjection/WikiTagExtension.php	Thu Oct 27 22:22:36 2011 +0200
@@ -41,5 +41,6 @@
         $container->setParameter("wiki_tag.document_id_column", $document_id);
         
         $container->setParameter("wiki_tag.fields", $config['fields']);
+        $container->setParameter("wiki_tag.route_for_documents_by_tag", $config['route_for_documents_by_tag']);
     }
 }