Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Persisting : forget a "use" statement ? #11062

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 2 commits into from
Closed
Changes from all commits
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
10 changes: 6 additions & 4 deletions 10 doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ and save it!
namespace App\Controller;

// ...
use Symfony\Component\HttpFoundation\Response;
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure it should be, as AbstractController is missing, too

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, the MakerBundle is used some lines above this to generate the controller. It already adds the abstract controller, but the response is not in there (See PR description). So I think it makes sense to add it explicitly in the docs (we usually add use statements in examples if they are new in that code block)

Copy link
Contributor

Choose a reason for hiding this comment

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

Didn’t notice it 👍🏻


use App\Entity\Product;

class ProductController extends AbstractController
Expand Down Expand Up @@ -386,17 +388,17 @@ Take a look at the previous example in more detail:

.. _doctrine-entity-manager:

* **line 16** The ``$this->getDoctrine()->getManager()`` method gets Doctrine's
* **line 18** The ``$this->getDoctrine()->getManager()`` method gets 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 18-21** In this section, you instantiate and work with the ``$product``
* **lines 20-23** In this section, you instantiate and work with the ``$product``
object like any other normal PHP object.

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

* **line 27** When the ``flush()`` method is called, Doctrine looks through
* **line 29** 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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.