diff --git a/book/controller.rst b/book/controller.rst index 48369b66227..efd310c8b33 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:: diff --git a/book/doctrine.rst b/book/doctrine.rst index 9a028e18d3d..b0f6f73c74f 100644 --- a/book/doctrine.rst +++ b/book/doctrine.rst @@ -472,7 +472,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 @@ -557,7 +559,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!'); @@ -1308,7 +1312,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 d57120857e9..37a2dacf214 100644 --- a/book/forms.rst +++ b/book/forms.rst @@ -1565,7 +1565,9 @@ method to specify the option:: { $collectionConstraint = new Collection(array( 'name' => new Length(array("min" => 5)), - 'email' => new Email(array('message' => 'Invalid email address')), + 'email' => new Email( + array('message' => 'Invalid email address') + ), )); $resolver->setDefaults(array( diff --git a/book/from_flat_php_to_symfony2.rst b/book/from_flat_php_to_symfony2.rst index 677ab92ad38..57f2713c6ad 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: