|
1 | 1 | .. index:: |
2 | 2 | single: Doctrine |
3 | 3 |
|
4 | | -Databases and Doctrine |
5 | | -====================== |
| 4 | +Databases and the Doctrine ORM |
| 5 | +============================== |
6 | 6 |
|
7 | 7 | One of the most common and challenging tasks for any application |
8 | 8 | involves persisting and reading information to and from a database. Although |
@@ -537,10 +537,10 @@ Take a look at the previous example in more detail: |
537 | 537 | responsible for the process of persisting objects to, and fetching objects |
538 | 538 | from, the database. |
539 | 539 |
|
540 | | -* **line 17** The ``persist($product)`` call tells Doctrine to "manage" the |
| 540 | +* **line 18** The ``persist($product)`` call tells Doctrine to "manage" the |
541 | 541 | ``$product`` object. This does **not** cause a query to be made to the database. |
542 | 542 |
|
543 | | -* **line 18** When the ``flush()`` method is called, Doctrine looks through |
| 543 | +* **line 21** When the ``flush()`` method is called, Doctrine looks through |
544 | 544 | all of the objects that it's managing to see if they need to be persisted |
545 | 545 | to the database. In this example, the ``$product`` object's data doesn't |
546 | 546 | exist in the database, so the entity manager executes an ``INSERT`` query, |
@@ -630,7 +630,7 @@ Once you have a repository object, you can access all sorts of helpful methods:: |
630 | 630 | Of course, you can also issue complex queries, which you'll learn more |
631 | 631 | about in the :ref:`doctrine-queries` section. |
632 | 632 |
|
633 | | -You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods |
| 633 | +You can also take advantage of the useful ``findBy()`` and ``findOneBy()`` methods |
634 | 634 | to easily fetch objects based on multiple conditions:: |
635 | 635 |
|
636 | 636 | $repository = $this->getDoctrine()->getRepository('AppBundle:Product'); |
@@ -689,7 +689,7 @@ Updating an object involves just three steps: |
689 | 689 |
|
690 | 690 | #. fetching the object from Doctrine; |
691 | 691 | #. modifying the object; |
692 | | -#. calling ``flush()`` on the entity manager |
| 692 | +#. calling ``flush()`` on the entity manager. |
693 | 693 |
|
694 | 694 | Notice that calling ``$em->persist($product)`` isn't necessary. Recall that |
695 | 695 | this method simply tells Doctrine to manage or "watch" the ``$product`` object. |
@@ -780,7 +780,7 @@ DQL as you start to concatenate strings:: |
780 | 780 | $repository = $this->getDoctrine() |
781 | 781 | ->getRepository('AppBundle:Product'); |
782 | 782 |
|
783 | | - // createQueryBuilder automatically selects FROM AppBundle:Product |
| 783 | + // createQueryBuilder() automatically selects FROM AppBundle:Product |
784 | 784 | // and aliases it to "p" |
785 | 785 | $query = $repository->createQueryBuilder('p') |
786 | 786 | ->where('p.price > :price') |
|
0 commit comments