@@ -830,36 +830,36 @@ be accomplished with the following route configuration:
830830 class MainController extends Controller
831831 {
832832 /**
833- * @Route("/contact ")
833+ * @Route("/news ")
834834 * @Method("GET")
835835 */
836- public function contactAction ()
836+ public function newsAction ()
837837 {
838- // ... display contact form
838+ // ... display your news
839839 }
840840
841841 /**
842842 * @Route("/contact")
843- * @Method(" POST")
843+ * @Method({"GET", " POST"} )
844844 */
845- public function processContactAction ()
845+ public function contactFormAction ()
846846 {
847- // ... process contact form
847+ // ... display and process a contact form
848848 }
849849 }
850850
851851 .. code-block :: yaml
852852
853853 # app/config/routing.yml
854- contact :
855- path : /contact
856- defaults : { _controller: AppBundle:Main:contact }
854+ news :
855+ path : /news
856+ defaults : { _controller: AppBundle:Main:news }
857857 methods : [GET]
858858
859- contact_process :
859+ contact_form :
860860 path : /contact
861- defaults : { _controller: AppBundle:Main:processContact }
862- methods : [POST]
861+ defaults : { _controller: AppBundle:Main:contactForm }
862+ methods : [GET, POST]
863863
864864 .. code-block :: xml
865865
@@ -870,12 +870,12 @@ be accomplished with the following route configuration:
870870 xsi : schemaLocation =" http://symfony.com/schema/routing
871871 http://symfony.com/schema/routing/routing-1.0.xsd" >
872872
873- <route id =" contact " path =" /contact " methods =" GET" >
874- <default key =" _controller" >AppBundle:Main:contact </default >
873+ <route id =" news " path =" /news " methods =" GET" >
874+ <default key =" _controller" >AppBundle:Main:news </default >
875875 </route >
876876
877- <route id =" contact_process " path =" /contact" methods =" POST" >
878- <default key =" _controller" >AppBundle:Main:processContact </default >
877+ <route id =" contact_form " path =" /contact" methods =" GET| POST" >
878+ <default key =" _controller" >AppBundle:Main:contactForm </default >
879879 </route >
880880 </routes >
881881
@@ -886,13 +886,13 @@ be accomplished with the following route configuration:
886886 use Symfony\Component\Routing\Route;
887887
888888 $collection = new RouteCollection();
889- $collection->add('contact ', new Route('/contact ', array(
889+ $collection->add('news ', new Route('/news ', array(
890890 '_controller' => 'AppBundle:Main:contact',
891891 ), array(), array(), '', array(), array('GET')));
892892
893- $collection->add('contact_process ', new Route('/contact', array(
894- '_controller' => 'AppBundle:Main:processContact ',
895- ), array(), array(), '', array(), array('POST')));
893+ $collection->add('contact_form ', new Route('/contact', array(
894+ '_controller' => 'AppBundle:Main:contactForm ',
895+ ), array(), array(), '', array(), array('GET', ' POST')));
896896
897897 return $collection;
898898
0 commit comments