diff --git a/best_practices/creating-the-project.rst b/best_practices/creating-the-project.rst index b180e2d3de6..a180eef9fd2 100644 --- a/best_practices/creating-the-project.rst +++ b/best_practices/creating-the-project.rst @@ -94,7 +94,7 @@ ProductBundle, InvoiceBundle, etc. But a bundle is *meant* to be something that can be reused as a stand-alone piece of software. If UserBundle cannot be used *"as is"* in other Symfony -apps, then it shouldn't be its own bundle. Moreover InvoiceBundle depends on +apps, then it shouldn't be its own bundle. Moreover, if InvoiceBundle depends on ProductBundle, then there's no advantage to having two separate bundles. .. best-practice:: diff --git a/book/controller.rst b/book/controller.rst index 62f5a1ba303..7ec7bd4ae3a 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -5,7 +5,7 @@ Controller ========== A controller is a PHP callable you create that takes information from the -HTTP request and constructs and returns an HTTP response (as a Symfony +HTTP request and creates and returns an HTTP response (as a Symfony ``Response`` object). The response could be an HTML page, an XML document, a serialized JSON array, an image, a redirect, a 404 error or anything else you can dream up. The controller contains whatever arbitrary logic *your @@ -34,7 +34,7 @@ common examples: for the homepage of the site. * *Controller B* reads the ``slug`` parameter from the request to load a - blog entry from the database and create a ``Response`` object displaying + blog entry from the database and creates a ``Response`` object displaying that blog. If the ``slug`` can't be found in the database, it creates and returns a ``Response`` object with a 404 status code. @@ -201,7 +201,7 @@ to the controller: return $collection; -Now, you can go to ``/hello/ryan`` (e.g. ``http://localhost:8000/app_dev.php/hello/ryan`` +Now, you can go to ``/hello/ryan`` (e.g. ``http://localhost:8000/hello/ryan`` if you're using the :doc:`built-in web server `) and Symfony will execute the ``HelloController::indexAction()`` controller and pass in ``ryan`` for the ``$name`` variable. Creating a "page" means @@ -490,7 +490,9 @@ You can also put templates in deeper sub-directories. Just try to avoid creating unnecessarily deep structures:: // renders app/Resources/views/hello/greetings/index.html.twig - return $this->render('hello/greetings/index.html.twig', array('name' => $name)); + return $this->render('hello/greetings/index.html.twig', array( + 'name' => $name + )); The Symfony templating engine is explained in great detail in the :doc:`Templating ` chapter. @@ -525,7 +527,7 @@ via the ``get()`` method. Here are several common services you might need:: $mailer = $this->get('mailer'); -What other services exist? You can list all services, use the ``debug:container`` +What other services exist? To list all services, use the ``debug:container`` console command: .. code-block:: bash diff --git a/cookbook/form/data_transformers.rst b/cookbook/form/data_transformers.rst index bfa8b472895..d3a368f9ea7 100644 --- a/cookbook/form/data_transformers.rst +++ b/cookbook/form/data_transformers.rst @@ -130,7 +130,7 @@ by calling ``addModelTransformer`` (or ``addViewTransformer`` - see // the "em" is an option that you pass when creating your form. Check out // the 3rd argument to createForm in the next code block to see how this - // is passed to the form (also see setDefaultOptions). + // is passed to the form (see also configureOptions). $entityManager = $options['em']; $transformer = new IssueToNumberTransformer($entityManager); diff --git a/cookbook/security/entity_provider.rst b/cookbook/security/entity_provider.rst index 081ca361f1b..bca65414289 100644 --- a/cookbook/security/entity_provider.rst +++ b/cookbook/security/entity_provider.rst @@ -435,9 +435,9 @@ interface requires three methods: ``loadUserByUsername($username)``, ->setParameter('username', $username) ->setParameter('email', $username) ->getQuery() - ->getOneOrNullResult() + ->getOneOrNullResult(); - if ($user) { + if (null === $user) { $message = sprintf( 'Unable to find an active admin AppBundle:User object identified by "%s".', $username diff --git a/cookbook/serializer.rst b/cookbook/serializer.rst index 75910f61e31..b84bf2e6b79 100644 --- a/cookbook/serializer.rst +++ b/cookbook/serializer.rst @@ -74,16 +74,16 @@ Here is an example on how to load the .. code-block:: yaml - # app/config/config.yml - services: - get_set_method_normalizer: - class: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer - tags: - - { name: serializer.normalizer } + # app/config/services.yml + services: + get_set_method_normalizer: + class: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer + tags: + - { name: serializer.normalizer } .. code-block:: xml - + @@ -92,7 +92,7 @@ Here is an example on how to load the .. code-block:: php - // app/config/config.php + // app/config/services.php use Symfony\Component\DependencyInjection\Definition; $definition = new Definition(