Skip to content

Replacing EntityManagerInterface -> $this->getDoctrine()->getManager(); #8089

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

Closed
wants to merge 4 commits into from
Closed

Replacing EntityManagerInterface -> $this->getDoctrine()->getManager(); #8089

wants to merge 4 commits into from

Conversation

weaverryan
Copy link
Member

When I was updating everything to use type-hints for 3.3, we had discussed that we should probably recommend using the helper method $this->getDoctrine() in the controller instead of type-hinting EntityManagerInterface. This reverts my changes to reflect that.

We had a conversation that we should use the helpers when they are available
@@ -586,7 +588,7 @@ Take a look at the previous example in more detail:

.. _doctrine-entity-manager:

* **line 10** The ``EntityManagerInterface`` type-hint tells Symfony to pass you Doctrine's
* **line 13** The ``$this->getDoctrine()->getManager()`` method gets Doctrine's
Copy link
Member Author

Choose a reason for hiding this comment

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

I verified all the lines are correct via platform.sh

{
$product = $em->getRepository('AppBundle:Product')
$product = $this->getDoctrine()
->getManager()
Copy link
Contributor

Choose a reason for hiding this comment

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

this line is useless, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch - removed it :)

doctrine.rst Outdated
@@ -551,10 +551,11 @@ a controller, this is pretty easy. Add the following method to the
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Common\Persistence\ManagerRegistry;
Copy link
Contributor

Choose a reason for hiding this comment

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

should be removed

{
// or fetch the em via the container
// $em = $this->get('doctrine')->getManager();
$em = $this->get('doctrine')->getManager();
Copy link
Contributor

Choose a reason for hiding this comment

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

We're not using getDoctrine() here?

@weaverryan weaverryan closed this in 9439177 Jul 2, 2017
xabbuh added a commit that referenced this pull request Jul 11, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

add back getDoctrine() in some more places

this completes #8089

Commits
-------

9e322d2 add back getDoctrine() in some more places
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants