diff --git a/docs/en/cookbook/aggregate-fields.rst b/docs/en/cookbook/aggregate-fields.rst index 5d0981b06..3d400c84a 100644 --- a/docs/en/cookbook/aggregate-fields.rst +++ b/docs/en/cookbook/aggregate-fields.rst @@ -149,7 +149,7 @@ collection, which means we can compute this value at runtime: public function getBalance() { $balance = 0; - foreach ($this->entries AS $entry) { + foreach ($this->entries as $entry) { $balance += $entry->getAmount(); } return $balance; diff --git a/docs/en/cookbook/dql-custom-walkers.rst b/docs/en/cookbook/dql-custom-walkers.rst index bcead51f4..e840126db 100644 --- a/docs/en/cookbook/dql-custom-walkers.rst +++ b/docs/en/cookbook/dql-custom-walkers.rst @@ -130,7 +130,7 @@ implementation is: { $parent = null; $parentName = null; - foreach ($this->_getQueryComponents() AS $dqlAlias => $qComp) { + foreach ($this->_getQueryComponents() as $dqlAlias => $qComp) { if ($qComp['parent'] === null && $qComp['nestingLevel'] == 0) { $parent = $qComp; $parentName = $dqlAlias; diff --git a/docs/en/cookbook/validation-of-entities.rst b/docs/en/cookbook/validation-of-entities.rst index a09b218e0..fb0254417 100644 --- a/docs/en/cookbook/validation-of-entities.rst +++ b/docs/en/cookbook/validation-of-entities.rst @@ -38,7 +38,7 @@ is allowed to: $orderLimit = $this->customer->getOrderLimit(); $amount = 0; - foreach ($this->orderLines AS $line) { + foreach ($this->orderLines as $line) { $amount += $line->getAmount(); } diff --git a/docs/en/reference/batch-processing.rst b/docs/en/reference/batch-processing.rst index 77b4e1720..f6a1b878e 100644 --- a/docs/en/reference/batch-processing.rst +++ b/docs/en/reference/batch-processing.rst @@ -76,7 +76,7 @@ with the batching strategy that was already used for bulk inserts: $i = 0; $q = $em->createQuery('select u from MyProject\Model\User u'); $iterableResult = $q->iterate(); - foreach($iterableResult AS $row) { + foreach ($iterableResult as $row) { $user = $row[0]; $user->increaseCredit(); $user->calculateNewBonuses(); @@ -162,7 +162,7 @@ problems using the following approach: _em->createQuery('select u from MyProject\Model\User u'); $iterableResult = $q->iterate(); - foreach ($iterableResult AS $row) { + foreach ($iterableResult as $row) { // do stuff with the data in the row, $row[0] is always the object // detach from Doctrine, so that it can be Garbage-Collected immediately diff --git a/docs/en/reference/events.rst b/docs/en/reference/events.rst index f4cf9776d..c37c0fc73 100644 --- a/docs/en/reference/events.rst +++ b/docs/en/reference/events.rst @@ -584,23 +584,23 @@ mentioned sets. See this example: $em = $eventArgs->getEntityManager(); $uow = $em->getUnitOfWork(); - foreach ($uow->getScheduledEntityInsertions() AS $entity) { + foreach ($uow->getScheduledEntityInsertions() as $entity) { } - foreach ($uow->getScheduledEntityUpdates() AS $entity) { + foreach ($uow->getScheduledEntityUpdates() as $entity) { } - foreach ($uow->getScheduledEntityDeletions() AS $entity) { + foreach ($uow->getScheduledEntityDeletions() as $entity) { } - foreach ($uow->getScheduledCollectionDeletions() AS $col) { + foreach ($uow->getScheduledCollectionDeletions() as $col) { } - foreach ($uow->getScheduledCollectionUpdates() AS $col) { + foreach ($uow->getScheduledCollectionUpdates() as $col) { } } diff --git a/docs/en/reference/working-with-associations.rst b/docs/en/reference/working-with-associations.rst index 863c5f210..f79da752d 100644 --- a/docs/en/reference/working-with-associations.rst +++ b/docs/en/reference/working-with-associations.rst @@ -468,7 +468,7 @@ removed from the system: find('User', $deleteUserId); - foreach ($user->getAuthoredComments() AS $comment) { + foreach ($user->getAuthoredComments() as $comment) { $em->remove($comment); } $em->remove($user); diff --git a/docs/en/reference/working-with-objects.rst b/docs/en/reference/working-with-objects.rst index 967a38010..a402be88c 100644 --- a/docs/en/reference/working-with-objects.rst +++ b/docs/en/reference/working-with-objects.rst @@ -143,7 +143,7 @@ your code. See the following code: // accessing the comments as an iterator triggers the lazy-load // retrieving ALL the comments of this article from the database // using a single SELECT statement - foreach ($article->getComments() AS $comment) { + foreach ($article->getComments() as $comment) { echo $comment->getText() . "\n\n"; } diff --git a/docs/en/tutorials/getting-started.rst b/docs/en/tutorials/getting-started.rst index 14270448f..d0b8ec634 100644 --- a/docs/en/tutorials/getting-started.rst +++ b/docs/en/tutorials/getting-started.rst @@ -1054,7 +1054,7 @@ like this: $bug->setCreated(new DateTime("now")); $bug->setStatus("OPEN"); - foreach ($productIds AS $productId) { + foreach ($productIds as $productId) { $product = $entityManager->find("Product", $productId); $bug->assignToProduct($product); } @@ -1108,11 +1108,11 @@ the first read-only use-case: $query->setMaxResults(30); $bugs = $query->getResult(); - foreach($bugs AS $bug) { + foreach ($bugs as $bug) { echo $bug->getDescription()." - ".$bug->getCreated()->format('d.m.Y')."\n"; echo " Reported by: ".$bug->getReporter()->getName()."\n"; echo " Assigned to: ".$bug->getEngineer()->getName()."\n"; - foreach($bug->getProducts() AS $product) { + foreach ($bug->getProducts() as $product) { echo " Platform: ".$product->getName()."\n"; } echo "\n"; @@ -1194,11 +1194,11 @@ can rewrite our code: $query = $entityManager->createQuery($dql); $bugs = $query->getArrayResult(); - foreach ($bugs AS $bug) { + foreach ($bugs as $bug) { echo $bug['description'] . " - " . $bug['created']->format('d.m.Y')."\n"; echo " Reported by: ".$bug['reporter']['name']."\n"; echo " Assigned to: ".$bug['engineer']['name']."\n"; - foreach($bug['products'] AS $product) { + foreach ($bug['products'] as $product) { echo " Platform: ".$product['name']."\n"; } echo "\n"; @@ -1312,7 +1312,7 @@ and usage of bound parameters: echo "You have created or assigned to " . count($myBugs) . " open bugs:\n\n"; - foreach ($myBugs AS $bug) { + foreach ($myBugs as $bug) { echo $bug->getId() . " - " . $bug->getDescription()."\n"; } @@ -1337,7 +1337,7 @@ grouped by product: "JOIN b.products p WHERE b.status = 'OPEN' GROUP BY p.id"; $productBugs = $entityManager->createQuery($dql)->getScalarResult(); - foreach($productBugs as $productBug) { + foreach ($productBugs as $productBug) { echo $productBug['name']." has " . $productBug['openBugs'] . " open bugs!\n"; } @@ -1417,7 +1417,7 @@ example querying for all closed bugs: $bugs = $entityManager->getRepository('Bug') ->findBy(array('status' => 'CLOSED')); - foreach ($bugs AS $bug) { + foreach ($bugs as $bug) { // do stuff } @@ -1519,11 +1519,11 @@ As an example here is the code of the first use case "List of Bugs": $bugs = $entityManager->getRepository('Bug')->getRecentBugs(); - foreach($bugs AS $bug) { + foreach ($bugs as $bug) { echo $bug->getDescription()." - ".$bug->getCreated()->format('d.m.Y')."\n"; echo " Reported by: ".$bug->getReporter()->getName()."\n"; echo " Assigned to: ".$bug->getEngineer()->getName()."\n"; - foreach($bug->getProducts() AS $product) { + foreach ($bug->getProducts() as $product) { echo " Platform: ".$product->getName()."\n"; } echo "\n";