diff --git a/book/controller.rst b/book/controller.rst index 273799255b4..bd23094c9cb 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -472,10 +472,13 @@ value to each variable. object:: $httpKernel = $this->container->get('http_kernel'); - $response = $httpKernel->forward('AcmeHelloBundle:Hello:fancy', array( - 'name' => $name, - 'color' => 'green', - )); + $response = $httpKernel->forward( + 'AcmeHelloBundle:Hello:fancy', + array( + 'name' => $name, + 'color' => 'green', + ) + ); .. index:: single: Controller; Rendering templates @@ -490,14 +493,20 @@ that's responsible for generating the HTML (or other format) for the controller. The ``renderView()`` method renders a template and returns its content. The content from the template can be used to create a ``Response`` object:: - $content = $this->renderView('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name)); + $content = $this->renderView( + 'AcmeHelloBundle:Hello:index.html.twig', + array('name' => $name) + ); return new Response($content); This can even be done in just one step with the ``render()`` method, which returns a ``Response`` object containing the content from the template:: - return $this->render('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name)); + return $this->render( + 'AcmeHelloBundle:Hello:index.html.twig', + array('name' => $name) + ); In both cases, the ``Resources/views/Hello/index.html.twig`` template inside the ``AcmeHelloBundle`` will be rendered. @@ -517,7 +526,10 @@ The Symfony templating engine is explained in great detail in the service. The ``templating`` service can also be used directly:: $templating = $this->get('templating'); - $content = $templating->render('AcmeHelloBundle:Hello:index.html.twig', array('name' => $name)); + $content = $templating->render( + 'AcmeHelloBundle:Hello:index.html.twig', + array('name' => $name) + ); .. note:: @@ -525,7 +537,10 @@ The Symfony templating engine is explained in great detail in the be careful to avoid the pitfall of making your directory structure unduly elaborate:: - $templating->render('AcmeHelloBundle:Hello/Greetings:index.html.twig', array('name' => $name)); + $templating->render( + 'AcmeHelloBundle:Hello/Greetings:index.html.twig', + array('name' => $name) + ); // index.html.twig found in Resources/views/Hello/Greetings is rendered. .. index:: @@ -642,7 +657,10 @@ For example, imagine you're processing a form submit:: if ($form->isValid()) { // do some sort of processing - $this->get('session')->setFlash('notice', 'Your changes were saved!'); + $this->get('session')->setFlash( + 'notice', + 'Your changes were saved!' + ); return $this->redirect($this->generateUrl(...)); } diff --git a/book/doctrine.rst b/book/doctrine.rst index 8dde967b0ca..60b32770259 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -470,7 +470,9 @@ on its ``id`` value:: ->find($id); if (!$product) { - throw $this->createNotFoundException('No product found for id '.$id); + throw $this->createNotFoundException( + 'No product found for id '.$id + ); } // ... do something, like pass the $product object into a template @@ -555,7 +557,9 @@ you have a route that maps a product id to an update action in a controller:: $product = $em->getRepository('AcmeStoreBundle:Product')->find($id); if (!$product) { - throw $this->createNotFoundException('No product found for id '.$id); + throw $this->createNotFoundException( + 'No product found for id '.$id + ); } $product->setName('New product name!'); @@ -1306,7 +1310,8 @@ and ``nullable``. Take a few examples: /** * A string field with length 255 that cannot be null - * (reflecting the default values for the "type", "length" and *nullable* options) + * (reflecting the default values for the "type", "length" + * and *nullable* options) * * @ORM\Column() */ diff --git a/book/forms.rst b/book/forms.rst index 471ac5e551c..2038047b0db 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1477,7 +1477,9 @@ method to specify the option:: { $collectionConstraint = new Collection(array( 'name' => new MinLength(5), - 'email' => new Email(array('message' => 'Invalid email address')), + 'email' => new Email( + array('message' => 'Invalid email address') + ), )); return array('validation_constraint' => $collectionConstraint); diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index f9ad97ee141..1894a9483a1 100644 --- a/book/from_flat_php_to_symfony2.rst +++ b/book/from_flat_php_to_symfony2.rst @@ -554,7 +554,10 @@ them for you. Here's the same sample application, now built in Symfony2:: ->createQuery('SELECT p FROM AcmeBlogBundle:Post p') ->execute(); - return $this->render('AcmeBlogBundle:Blog:list.html.php', array('posts' => $posts)); + return $this->render( + 'AcmeBlogBundle:Blog:list.html.php', + array('posts' => $posts) + ); } public function showAction($id) @@ -570,7 +573,10 @@ them for you. Here's the same sample application, now built in Symfony2:: throw $this->createNotFoundException(); } - return $this->render('AcmeBlogBundle:Blog:show.html.php', array('post' => $post)); + return $this->render( + 'AcmeBlogBundle:Blog:show.html.php', + array('post' => $post) + ); } } @@ -590,7 +596,10 @@ now quite a bit simpler: