From b4919b885acc6448bbc5044de03ae4dce1c00a88 Mon Sep 17 00:00:00 2001 From: Sebastien Armand Date: Wed, 27 Jun 2012 19:20:49 +0800 Subject: [PATCH 1/2] Add that was missing on code examples for how to update with the query builder --- en/reference/query-builder-api.rst | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/en/reference/query-builder-api.rst b/en/reference/query-builder-api.rst index eb6eb067b1..ba7cd6c3e8 100644 --- a/en/reference/query-builder-api.rst +++ b/en/reference/query-builder-api.rst @@ -491,7 +491,7 @@ Change a users password: createQueryBuilder('User') + $dm->createQueryBuilder('User')->update() ->field('password')->set('newpassword') ->field('username')->equals('jwage') ->getQuery() @@ -505,7 +505,7 @@ tell it the update is not an atomic one: createQueryBuilder('User') + $dm->createQueryBuilder('User')->update() ->field('username')->set('jwage', false) ->field('password')->set('password', false) // ... set other remaining fields @@ -556,7 +556,7 @@ exists: createQueryBuilder('User') + $dm->createQueryBuilder('User')->update() ->field('login')->unsetField()->exists(true) ->getQuery() ->execute(); @@ -571,7 +571,7 @@ Append new tag to the tags array: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->push('tag5') ->field('id')->equals('theid') ->getQuery() @@ -587,7 +587,7 @@ Append new tags to the tags array: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->pushAll(array('tag6', 'tag7')) ->field('id')->equals('theid') ->getQuery() @@ -603,7 +603,7 @@ Add value to array only if its not in the array already: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->addToSet('tag1') ->field('id')->equals('theid') ->getQuery() @@ -620,7 +620,7 @@ already: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->addManyToSet(array('tag6', 'tag7')) ->field('id')->equals('theid') ->getQuery() @@ -636,7 +636,7 @@ Remove first element in an array: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->popFirst() ->field('id')->equals('theid') ->getQuery() @@ -648,7 +648,7 @@ Remove last element in an array: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->popLast() ->field('id')->equals('theid') ->getQuery() @@ -664,7 +664,7 @@ Remove all occurrences of value from array: createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->pull('tag1') ->getQuery() ->execute(); @@ -677,7 +677,7 @@ in the Mongo docs. createQueryBuilder('Article') + $dm->createQueryBuilder('Article')->update() ->field('tags')->pullAll(array('tag1', 'tag2')) ->getQuery() ->execute(); From 60556777167e539700361c89b59e359b0823ec7c Mon Sep 17 00:00:00 2001 From: Sebastien Armand Date: Thu, 28 Jun 2012 00:44:13 +0800 Subject: [PATCH 2/2] Fix formatting --- en/reference/query-builder-api.rst | 33 ++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/en/reference/query-builder-api.rst b/en/reference/query-builder-api.rst index ba7cd6c3e8..5fd5bd45db 100644 --- a/en/reference/query-builder-api.rst +++ b/en/reference/query-builder-api.rst @@ -491,7 +491,8 @@ Change a users password: createQueryBuilder('User')->update() + $dm->createQueryBuilder('User') + ->update() ->field('password')->set('newpassword') ->field('username')->equals('jwage') ->getQuery() @@ -505,7 +506,8 @@ tell it the update is not an atomic one: createQueryBuilder('User')->update() + $dm->createQueryBuilder('User') + ->update() ->field('username')->set('jwage', false) ->field('password')->set('password', false) // ... set other remaining fields @@ -556,7 +558,8 @@ exists: createQueryBuilder('User')->update() + $dm->createQueryBuilder('User') + ->update() ->field('login')->unsetField()->exists(true) ->getQuery() ->execute(); @@ -571,7 +574,8 @@ Append new tag to the tags array: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->push('tag5') ->field('id')->equals('theid') ->getQuery() @@ -587,7 +591,8 @@ Append new tags to the tags array: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->pushAll(array('tag6', 'tag7')) ->field('id')->equals('theid') ->getQuery() @@ -603,7 +608,8 @@ Add value to array only if its not in the array already: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->addToSet('tag1') ->field('id')->equals('theid') ->getQuery() @@ -620,7 +626,8 @@ already: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->addManyToSet(array('tag6', 'tag7')) ->field('id')->equals('theid') ->getQuery() @@ -636,7 +643,8 @@ Remove first element in an array: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->popFirst() ->field('id')->equals('theid') ->getQuery() @@ -648,7 +656,8 @@ Remove last element in an array: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->popLast() ->field('id')->equals('theid') ->getQuery() @@ -664,7 +673,8 @@ Remove all occurrences of value from array: createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->pull('tag1') ->getQuery() ->execute(); @@ -677,7 +687,8 @@ in the Mongo docs. createQueryBuilder('Article')->update() + $dm->createQueryBuilder('Article') + ->update() ->field('tags')->pullAll(array('tag1', 'tag2')) ->getQuery() ->execute();