|
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 |
@@ -582,10 +582,10 @@ Take a look at the previous example in more detail: |
582 | 582 | responsible for the process of persisting objects to, and fetching objects |
583 | 583 | from, the database. |
584 | 584 |
|
585 | | -* **line 17** The ``persist($product)`` call tells Doctrine to "manage" the |
| 585 | +* **line 18** The ``persist($product)`` call tells Doctrine to "manage" the |
586 | 586 | ``$product`` object. This does **not** cause a query to be made to the database. |
587 | 587 |
|
588 | | -* **line 18** When the ``flush()`` method is called, Doctrine looks through |
| 588 | +* **line 21** When the ``flush()`` method is called, Doctrine looks through |
589 | 589 | all of the objects that it's managing to see if they need to be persisted |
590 | 590 | to the database. In this example, the ``$product`` object's data doesn't |
591 | 591 | exist in the database, so the entity manager executes an ``INSERT`` query, |
@@ -675,7 +675,7 @@ Once you have a repository object, you can access all sorts of helpful methods:: |
675 | 675 | Of course, you can also issue complex queries, which you'll learn more |
676 | 676 | about in the :ref:`doctrine-queries` section. |
677 | 677 |
|
678 | | -You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods |
| 678 | +You can also take advantage of the useful ``findBy()`` and ``findOneBy()`` methods |
679 | 679 | to easily fetch objects based on multiple conditions:: |
680 | 680 |
|
681 | 681 | $repository = $this->getDoctrine()->getRepository('AppBundle:Product'); |
@@ -734,7 +734,7 @@ Updating an object involves just three steps: |
734 | 734 |
|
735 | 735 | #. fetching the object from Doctrine; |
736 | 736 | #. modifying the object; |
737 | | -#. calling ``flush()`` on the entity manager |
| 737 | +#. calling ``flush()`` on the entity manager. |
738 | 738 |
|
739 | 739 | Notice that calling ``$em->persist($product)`` isn't necessary. Recall that |
740 | 740 | this method simply tells Doctrine to manage or "watch" the ``$product`` object. |
@@ -825,7 +825,7 @@ DQL as you start to concatenate strings:: |
825 | 825 | $repository = $this->getDoctrine() |
826 | 826 | ->getRepository('AppBundle:Product'); |
827 | 827 |
|
828 | | - // createQueryBuilder automatically selects FROM AppBundle:Product |
| 828 | + // createQueryBuilder() automatically selects FROM AppBundle:Product |
829 | 829 | // and aliases it to "p" |
830 | 830 | $query = $repository->createQueryBuilder('p') |
831 | 831 | ->where('p.price > :price') |
|
0 commit comments