Skip to content

A few minor improvements #7113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 10, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doctrine/associations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ You can also query in the other direction::

In this case, the same things occur: you first query out for a single ``Category``
object, and then Doctrine makes a second query to retrieve the related ``Product``
objects, but only once/if you ask for them (i.e. when you call ``->getProducts()``).
objects, but only once/if you ask for them (i.e. when you call ``getProducts()``).
The ``$products`` variable is an array of all ``Product`` objects that relate
to the given ``Category`` object via their ``category_id`` value.

Expand Down Expand Up @@ -365,7 +365,7 @@ Of course, if you know up front that you'll need to access both objects, you
can avoid the second query by issuing a join in the original query. Add the
following method to the ``ProductRepository`` class::

// src/AppBundle/Entity/ProductRepository.php
// src/AppBundle/Repository/ProductRepository.php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other chapters (doctrine/repository.rst, security/entity_provider.rst, testing/doctrine.rst), we have the repository classes in the Entity subnamespace. We should either update them as well or keep this example as is.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

best_practices/configuration.rst on other hand also uses the Repository namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think to keep entities and repositories separately is a better option. Let's use the Repository namespace like in best practices. I'll push more changes

public function findOneByIdJoinedToCategory($productId)
{
$query = $this->getEntityManager()
Expand Down Expand Up @@ -407,7 +407,7 @@ Doctrine's `Association Mapping Documentation`_.
.. note::

If you're using annotations, you'll need to prepend all annotations with
``ORM\`` (e.g. ``ORM\OneToMany``), which is not reflected in Doctrine's
``@ORM\`` (e.g. ``@ORM\OneToMany``), which is not reflected in Doctrine's
documentation. You'll also need to include the ``use Doctrine\ORM\Mapping as ORM;``
statement, which *imports* the ``ORM`` annotations prefix.

Expand Down