diff --git a/en/reference/annotations-reference.rst b/en/reference/annotations-reference.rst index 363058944..5d4e9ee09 100644 --- a/en/reference/annotations-reference.rst +++ b/en/reference/annotations-reference.rst @@ -494,7 +494,7 @@ Example: `_. +`in this blog post `_. diff --git a/en/reference/change-tracking-policies.rst b/en/reference/change-tracking-policies.rst index 7bd884910..d0f099895 100644 --- a/en/reference/change-tracking-policies.rst +++ b/en/reference/change-tracking-policies.rst @@ -30,8 +30,8 @@ Deferred Explicit The deferred explicit policy is similar to the deferred implicit policy in that it detects changes through a property-by-property -comparison at commit time. The difference is that only entities are -considered that have been explicitly marked for change detection +comparison at commit time. The difference is that Doctrine 2 only +considers entities that have been explicitly marked for change detection through a call to EntityManager#persist(entity) or through a save cascade. All other entities are skipped. This policy therefore gives improved performance for larger units of work while diff --git a/en/reference/dql-doctrine-query-language.rst b/en/reference/dql-doctrine-query-language.rst index cd9e6a97a..901f7f594 100644 --- a/en/reference/dql-doctrine-query-language.rst +++ b/en/reference/dql-doctrine-query-language.rst @@ -35,7 +35,7 @@ object model. DQL SELECT statements are a very powerful way of retrieving parts of your domain model that are not accessible via associations. Additionally they allow to retrieve entities and their associations -in one single sql select statement which can make a huge difference +in one single SQL select statement which can make a huge difference in performance in contrast to using several queries. DQL UPDATE and DELETE statements offer a way to execute bulk @@ -67,7 +67,7 @@ Lets examine the query: - ``u`` is a so called identification variable or alias that refers to the ``MyProject\Model\User`` class. By placing this alias in the SELECT clause we specify that we want all instances of the - User class that are matched by this query appear in the query + User class that are matched by this query to appear in the query result. - The FROM keyword is always followed by a fully-qualified class name which in turn is followed by an identification variable or @@ -160,7 +160,7 @@ with numbers, for example "?1", "?2" and so on. Named parameters are specified with ":name1", ":name2" and so on. When referencing the parameters in ``Query#setParameter($param, $value)`` -both named and positional parameters are used **without** their prefixies. +both named and positional parameters are used **without** their prefixes. DQL SELECT Examples ~~~~~~~~~~~~~~~~~~~ @@ -208,7 +208,7 @@ Retrieve the Username and Name of a CmsUser: createQuery('SELECT u.username, u.name FROM CmsUser u'); - $users = $query->getResults(); // array of CmsUser username and id values + $users = $query->getResults(); // array of CmsUser username and name values echo $users[0]['username']; Retrieve a ForumUser and his single associated entity: @@ -268,7 +268,7 @@ With WHERE Clause and Named Parameter: createQuery('SELECT u FROM ForumUser u WHERE u.username = :name'); - $query->setParameter(':name', 'Bob'); + $query->setParameter('name', 'Bob'); $users = $query->getResult(); // array of ForumUser objects With Nested Conditions in WHERE Clause: @@ -278,9 +278,9 @@ With Nested Conditions in WHERE Clause: createQuery('SELECT u from ForumUser u WHERE (u.username = :name OR u.username = :name2) AND u.id = :id'); $query->setParameters(array( - ':name' => 'Bob', - ':name2' => 'Alice', - ':id' => 321, + 'name' => 'Bob', + 'name2' => 'Alice', + 'id' => 321, )); $users = $query->getResult(); // array of ForumUser objects @@ -384,7 +384,7 @@ Get all users who are members of $group. createQuery('SELECT u.id FROM CmsUser u WHERE :groupId MEMBER OF u.groups'); - $query->setParameter(':groupId', $group); + $query->setParameter('groupId', $group); $ids = $query->getResult(); Get all users that have more than 1 phonenumber @@ -915,12 +915,12 @@ structure: .. code-block:: php array - array + [0] [0] => Object [1] => "some scalar string" ['count'] => 42 // ... more scalar values, either indexed numerically or with a name - array + [1] [0] => Object [1] => "some scalar string" ['count'] => 42 diff --git a/en/reference/events.rst b/en/reference/events.rst index ccdf199c8..c8b116cc9 100644 --- a/en/reference/events.rst +++ b/en/reference/events.rst @@ -201,8 +201,8 @@ listeners: All Lifecycle events that happen during the ``flush()`` of an EntityManager have very specific constraints on the allowed operations that can be executed. Please read the - *Implementing Event Listeners* section very carefully to understand - which operations are allowed in which lifecycle event. + :ref:`reference-events-implementing-listeners` section very carefully + to understand which operations are allowed in which lifecycle event. Lifecycle Callbacks @@ -361,6 +361,8 @@ EntityManager was created: $entityManager->getEventManager()->addEventListener(array(Events::preUpdate), MyEventListener()); $entityManager->getEventManager()->addEventSubscriber(new MyEventSubscriber()); +.. _reference-events-implementing-listeners: + Implementing Event Listeners ---------------------------- diff --git a/en/reference/query-builder.rst b/en/reference/query-builder.rst index 7c1d2d8cd..1195be59a 100644 --- a/en/reference/query-builder.rst +++ b/en/reference/query-builder.rst @@ -199,6 +199,7 @@ a querybuilder instance into a Query object: .. code-block:: php + getQuery(); diff --git a/en/reference/working-with-associations.rst b/en/reference/working-with-associations.rst index 8edd54eaf..5a78f6ac7 100644 --- a/en/reference/working-with-associations.rst +++ b/en/reference/working-with-associations.rst @@ -29,7 +29,7 @@ Association Example Entities We will use a simple comment system with Users and Comments as entities to show examples of association management. See the PHP docblocks of each association in the following example for -information about its type and if its the owning or inverse side. +information about its type and if it's the owning or inverse side. .. code-block:: php @@ -398,7 +398,7 @@ can show the possible caveats you can encounter: $user->getFavorites()->contains($favoriteComment); // TRUE $favoriteComment->getUserFavorites()->contains($user); // FALSE -There are to approaches to handle this problem in your code: +There are two approaches to handle this problem in your code: 1. Ignore updating the inverse side of bidirectional collections, @@ -413,7 +413,7 @@ Transitive persistence / Cascade Operations ------------------------------------------- Persisting, removing, detaching and merging individual entities can -become pretty cumbersome, especially when a larger object graph +become pretty cumbersome, especially when a large object graph with collections is involved. Therefore Doctrine 2 provides a mechanism for transitive persistence through cascading of these operations. Each association to another entity or a collection of @@ -531,7 +531,8 @@ OrphanRemoval works with both one-to-one and one-to-many associations. When using the ``orphanRemoval=true`` option Doctrine makes the assumption that the entities are privately owned and will **NOT** be reused by other entities. - If you neglect this assumption your entities will get deleted by Doctrine anyways. + If you neglect this assumption your entities will get deleted by Doctrine even if + you assigned the orphaned entity to another one. As a better example consider an Addressbook application where you have Contacts, Addresses and StandingData: @@ -588,5 +589,5 @@ Now two examples what happens when you remove the references: In this case you have only changed the ``Contact`` entity but you removed the references for standing data and one address reference. When flush is called -not only are the references removed also both the old standing data and the one address entity -are deleted from the database. +not only are the references removed but both the old standing data and the one +address entity are also deleted from the database. \ No newline at end of file