Skip to content
Prev Previous commit
Next Next commit
Tweaks
  • Loading branch information
weaverryan committed May 16, 2017
commit 1b82e39e1ab3b78d26d0f5fed831e3de7d26ba00
17 changes: 9 additions & 8 deletions doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,6 @@ a controller, this is pretty easy. Add the following method to the
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Persistence\ManagerRegistry;

// ...
public function createAction(EntityManagerInterface $em)
{
// or fetch the em via the container
Expand Down Expand Up @@ -585,17 +584,19 @@ a controller, this is pretty easy. Add the following method to the

Take a look at the previous example in more detail:

* **lines 10-13** In this section, you instantiate and work with the ``$product``
object like any other normal PHP object.
.. _doctrine-entity-manager:

* **line 15** This line fetches Doctrine's *entity manager* object, which is
responsible for the process of persisting objects to, and fetching objects
from, the database.
* **line 10** The ``EntityManagerInterface`` type-hint tells Symfony to pass you Doctrine's
*entity manager* object, which is the most important object in Doctrine. It's
responsible for saving objects to, and fetching objects from, the database.

* **lines 15-18** In this section, you instantiate and work with the ``$product``
object like any other normal PHP object.

* **line 18** The ``persist($product)`` call tells Doctrine to "manage" the
* **line 21** The ``persist($product)`` call tells Doctrine to "manage" the
``$product`` object. This does **not** cause a query to be made to the database.

* **line 21** When the ``flush()`` method is called, Doctrine looks through
* **line 24** When the ``flush()`` method is called, Doctrine looks through
all of the objects that it's managing to see if they need to be persisted
to the database. In this example, the ``$product`` object's data doesn't
exist in the database, so the entity manager executes an ``INSERT`` query,
Expand Down
2 changes: 1 addition & 1 deletion event_dispatcher/before_after_filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ you want.

.. tip::

If your subscriber id *not* called on each request, double-check that
If your subscriber is *not* called on each request, double-check that
you're :ref:`loading services <service-container-services-load-example>` from
the ``EventSubscriber`` directory and have :ref:`autoconfigure <services-autoconfigure>`
enabled. You can also manually add the ``kernel.event_subscriber`` tag.
Expand Down
2 changes: 1 addition & 1 deletion form/create_custom_field_type.rst
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ Accessing Services and Config
-----------------------------

If you need to access :doc:`services </service_container>` from your form class,
just a ``__construct()`` method like normal::
add a ``__construct()`` method like normal::

// src/AppBundle/Form/Type/GenderType.php
namespace AppBundle\Form\Type;
Expand Down
8 changes: 4 additions & 4 deletions form/form_dependencies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ Alternatively, you can define your form class as a service. This is a good idea
you want to re-use the form in several places - registering it as a service makes
this easier.

Suppose you need to access the ``EntityManager`` service so that you
can make a query. First, add this as an argument to your form class::
Suppose you need to access the :ref:`EntityManager <doctrine-entity-manager>` object
so that you can make a query. First, add this as an argument to your form class::

// src/AppBundle/Form/TaskType.php

Expand All @@ -93,8 +93,8 @@ can make a query. First, add this as an argument to your form class::

If you're using :ref:`autowire <services-autowire>` and
:ref:`autoconfigure <services-autoconfigure>`, then you don't need to do *anything*
else: Symfony will automatically know to pass the entity manager service to your
form type.
else: Symfony will automatically know to pass the correct ``EntityManager`` object
to your ``__construct()`` method.

If you are **not using autowire and autoconfigure**, register your form as a service
manually and tag it with ``form.type``:
Expand Down
4 changes: 0 additions & 4 deletions service_container/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ and hidden with the service definition:
// But % does need to be escaped
$container->setParameter('url_pattern', 'http://symfony.com/?foo=%%s&amp;bar=%%d');

.. code-block:: yaml



Getting and Setting Container Parameters in PHP
-----------------------------------------------

Expand Down