@@ -833,36 +833,36 @@ be accomplished with the following route configuration:
833
833
class MainController extends Controller
834
834
{
835
835
/**
836
- * @Route("/contact ")
836
+ * @Route("/news ")
837
837
* @Method("GET")
838
838
*/
839
- public function contactAction ()
839
+ public function newsAction ()
840
840
{
841
- // ... display contact form
841
+ // ... display your news
842
842
}
843
843
844
844
/**
845
845
* @Route("/contact")
846
- * @Method(" POST")
846
+ * @Method({"GET", " POST"} )
847
847
*/
848
- public function processContactAction ()
848
+ public function contactFormAction ()
849
849
{
850
- // ... process contact form
850
+ // ... display and process a contact form
851
851
}
852
852
}
853
853
854
854
.. code-block :: yaml
855
855
856
856
# app/config/routing.yml
857
- contact :
858
- path : /contact
859
- defaults : { _controller: AppBundle:Main:contact }
857
+ news :
858
+ path : /news
859
+ defaults : { _controller: AppBundle:Main:news }
860
860
methods : [GET]
861
861
862
- contact_process :
862
+ contact_form :
863
863
path : /contact
864
- defaults : { _controller: AppBundle:Main:processContact }
865
- methods : [POST]
864
+ defaults : { _controller: AppBundle:Main:contactForm }
865
+ methods : [GET, POST]
866
866
867
867
.. code-block :: xml
868
868
@@ -873,12 +873,12 @@ be accomplished with the following route configuration:
873
873
xsi : schemaLocation =" http://symfony.com/schema/routing
874
874
http://symfony.com/schema/routing/routing-1.0.xsd" >
875
875
876
- <route id =" contact " path =" /contact " methods =" GET" >
877
- <default key =" _controller" >AppBundle:Main:contact </default >
876
+ <route id =" news " path =" /news " methods =" GET" >
877
+ <default key =" _controller" >AppBundle:Main:news </default >
878
878
</route >
879
879
880
- <route id =" contact_process " path =" /contact" methods =" POST" >
881
- <default key =" _controller" >AppBundle:Main:processContact </default >
880
+ <route id =" contact_form " path =" /contact" methods =" GET| POST" >
881
+ <default key =" _controller" >AppBundle:Main:contactForm </default >
882
882
</route >
883
883
</routes >
884
884
@@ -889,13 +889,13 @@ be accomplished with the following route configuration:
889
889
use Symfony\Component\Routing\Route;
890
890
891
891
$collection = new RouteCollection();
892
- $collection->add('contact ', new Route('/contact ', array(
892
+ $collection->add('news ', new Route('/news ', array(
893
893
'_controller' => 'AppBundle:Main:contact',
894
894
), array(), array(), '', array(), array('GET')));
895
895
896
- $collection->add('contact_process ', new Route('/contact', array(
897
- '_controller' => 'AppBundle:Main:processContact ',
898
- ), array(), array(), '', array(), array('POST')));
896
+ $collection->add('contact_form ', new Route('/contact', array(
897
+ '_controller' => 'AppBundle:Main:contactForm ',
898
+ ), array(), array(), '', array(), array('GET', ' POST')));
899
899
900
900
return $collection;
901
901
0 commit comments