Permalink
Browse files

#7 - Some symfony 2 code style to methods

  • Loading branch information...
1 parent 37f32ff commit 79019f2615f7c4d5e97e4eb0a37adc7025b272ef @egulias committed Apr 14, 2012
Showing with 18 additions and 11 deletions.
  1. +18 −11 src/SFM/WebsiteBundle/Controller/DefaultController.php
@@ -20,20 +20,21 @@ class DefaultController extends Controller {
* @return array
* @Route("/", name="home")
*/
- public function indexAction() {
+ public function indexAction()
+ {
$em = $this->getDoctrine()->getEntityManager();
$nextEvent = $em->getRepository('SFMWebsiteBundle:Event')->getNextEvent();
$sfm = $this->get('sfm.feed_generator')->generateEventsFeed();
$response = $this->render('SFMWebsiteBundle:Default:index.html.twig', array(
'current' => 'home',
'nextEvent' => $nextEvent,
- ));
+ ));
$response->setExpires(new \DateTime('now + 15 minutes'));
$response->setMaxAge(15 * 60);
-
- return $response;
-
+
+ return $response;
+
}
/**
@@ -43,7 +44,8 @@ public function indexAction() {
* @Route("/acerca-de", name="about")
* @Template()
*/
- public function aboutAction() {
+ public function aboutAction()
+ {
/**
* Better a random order than alphabetical :)
*/
@@ -70,7 +72,8 @@ public function aboutAction() {
* @Method("get")
* @Template()
*/
- public function contactAction() {
+ public function contactAction()
+ {
return array(
'current' => 'contact',
);
@@ -84,7 +87,8 @@ public function contactAction() {
* @Method("post")
* @Template()
*/
- public function sendMailAction() {
+ public function sendMailAction()
+ {
$contactData = array(
'nombre' => $this->getRequest()->get('nombre'),
'email' => $this->getRequest()->get('email'),
@@ -116,7 +120,8 @@ public function sendMailAction() {
*
* @param array $contactData Data given from contact form.
*/
- private function sendMailOnContactFormSuccess(Array $contactData) {
+ private function sendMailOnContactFormSuccess(Array $contactData)
+ {
$mailTo = $this->container->getParameter('contactmail');
$message = \Swift_Message::newInstance()
@@ -134,7 +139,8 @@ private function sendMailOnContactFormSuccess(Array $contactData) {
* @param array $contactData
* @throws \Symfony\Component\HttpKernel\Exception\HttpException
*/
- private function validateContactData(array $contactData) {
+ private function validateContactData(array $contactData)
+ {
$collectionConstraint = new Collection(array(
'nombre' => array(
new NotBlank()
@@ -154,7 +160,8 @@ private function validateContactData(array $contactData) {
}
}
- private function parseErrors($errors) {
+ private function parseErrors($errors)
+ {
$translator = $this->container->get('translator');
$parsedErrors = array();

0 comments on commit 79019f2

Please sign in to comment.