Skip to content
This repository has been archived by the owner on Apr 2, 2018. It is now read-only.

Commit

Permalink
Merge origin/master
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Nov 5, 2011
2 parents 0193bb3 + 7d14db6 commit 11d6abb
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.pyc
Binary file removed en/_exts/configurationblock.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions en/reference/introduction.rst
Expand Up @@ -58,7 +58,7 @@ No abstract/base-class nor interface was implemented, yet you can save an object
private $headline; private $headline;
/** @Field(type="string") */ /** @Field(type="string") */
private $text; private $text;
/** @Field(type="datetime) */ /** @Field(type="datetime") */
private $publishDate; private $publishDate;
// getter/setter here // getter/setter here
Expand Down Expand Up @@ -112,7 +112,7 @@ Write-Behind


You may ask yourself why ``persist`` and ``flush`` are two separate functions in the previous example. Doctrine persistence semantics apply a performance optimization technique by aggregating all the required changes and synchronizing them back to the database at once. In the case of CouchDB ODM this means that all changes on objects (managed by CouchDB) in memory of the current PHP request are synchronized to CouchDB in a single POST request using the HTTP Bulk Document API. Compared to making an update request per document this leads to a considerable increase in performance. You may ask yourself why ``persist`` and ``flush`` are two separate functions in the previous example. Doctrine persistence semantics apply a performance optimization technique by aggregating all the required changes and synchronizing them back to the database at once. In the case of CouchDB ODM this means that all changes on objects (managed by CouchDB) in memory of the current PHP request are synchronized to CouchDB in a single POST request using the HTTP Bulk Document API. Compared to making an update request per document this leads to a considerable increase in performance.


This approach has a drawback though with regards to the transactional semantics of CouchDB. By default the bulk update is forced using the allOrNothing parameter of the HTTP BUlk Document API, which means that in case of different versioning numbers it will produce document conflicts that you have to resolve later. Doctrine CouchDB ODM offers an event to resolve any document conflict and it is planned to offer automatic resolution strategies such as "First-One Wins" or "Last-One Wins". If you don't enable forcing changes to the CouchDB you can end up with inconsistent state, for example if one update of a document is accepted and another one is rejected. This approach has a drawback though with regards to the transactional semantics of CouchDB. By default the bulk update is forced using the allOrNothing parameter of the HTTP Bulk Document API, which means that in case of different versioning numbers it will produce document conflicts that you have to resolve later. Doctrine CouchDB ODM offers an event to resolve any document conflict and it is planned to offer automatic resolution strategies such as "First-One Wins" or "Last-One Wins". If you don't enable forcing changes to the CouchDB you can end up with inconsistent state, for example if one update of a document is accepted and another one is rejected.


We haven't actually figured out the best way of handling "object transactions" ourselfes, but are experimenting with it to find the best possible solution before releasing a stable Doctrine CouchDB version. Feedback in this area is highly appreciated. We haven't actually figured out the best way of handling "object transactions" ourselfes, but are experimenting with it to find the best possible solution before releasing a stable Doctrine CouchDB version. Feedback in this area is highly appreciated.


Expand Down
20 changes: 9 additions & 11 deletions en/reference/map-reduce-queries.rst
Expand Up @@ -15,7 +15,7 @@ design document in the database:
.. code-block:: php .. code-block:: php
<?php <?php
use Doctrine\ODM\CouchDB\View\FolderDesignDocument; use Doctrine\CouchDB\View\FolderDesignDocument;
$view = new FolderDesignDocument("path/to/app/couchdb"); $view = new FolderDesignDocument("path/to/app/couchdb");
$designDocJson = $view->getData(); $designDocJson = $view->getData();
Expand All @@ -41,7 +41,7 @@ the username map.js might look like:
.. code-block:: javascript .. code-block:: javascript
function(doc) { function(doc) {
if (doc.doctrine_metadata.type == 'Doctrine.Tests.Models.CMS.CmsUser') { if (doc.type == 'Doctrine.Tests.Models.CMS.CmsUser') {
emit(doc.username, doc._id); emit(doc.username, doc._id);
} }
} }
Expand All @@ -59,7 +59,7 @@ in the CouchDB ODM Configuration:
$config = $dm->getConfiguration(); $config = $dm->getConfiguration();
$config->addDesignDocument( $config->addDesignDocument(
"myapp", "myapp",
"Doctrine\ODM\CouchDB\View\FolderDesignDocument", "Doctrine\CouchDB\View\FolderDesignDocument",
"path/to/app/couchdb" "path/to/app/couchdb"
); );
Expand All @@ -78,7 +78,7 @@ Both queries have a common base class with a simple API:
<?php <?php
namespace Doctrine\ODM\CouchDB\View; namespace Doctrine\CouchDB\View;
abstract class AbstractQuery abstract class AbstractQuery
{ {
Expand Down Expand Up @@ -114,9 +114,7 @@ The following query parameter related methods exist in both the native and odm-q
.. code-block:: php .. code-block:: php
<?php <?php
namespace Doctrine\ODM\CouchDB\View; namespace Doctrine\CouchDB\View;
use Doctrine\ODM\CouchDB\DocumentManager;
class Query extends AbstractQuery class Query extends AbstractQuery
{ {
Expand Down Expand Up @@ -249,8 +247,8 @@ An example execution of the username view given above looks like:
$query = $dm->createQuery("myapp", "username"); $query = $dm->createQuery("myapp", "username");
$result = $query->setStartKey("b") $result = $query->setStartKey("b")
->setEndKey("c") ->setEndKey("c")
->limit(100) ->setLimit(100)
->skip(20) ->setSkip(20)
->onlyDocs(true) ->onlyDocs(true)
->execute(); ->execute();
Expand All @@ -275,8 +273,8 @@ The following snippet shows the difference:
$query = $dm->createQuery("myapp", "username"); $query = $dm->createQuery("myapp", "username");
$result = $query->setStartKey("b") $result = $query->setStartKey("b")
->setEndKey("c") ->setEndKey("c")
->limit(100) ->setLimit(100)
->skip(20) ->setSkip(20)
->onlyDocs(true) ->onlyDocs(true)
->execute(); ->execute();
Expand Down
2 changes: 1 addition & 1 deletion en/reference/working-with-objects.rst
Expand Up @@ -461,7 +461,7 @@ methods on a repository as follows:
// A single user by its nickname // A single user by its nickname
$user = $dm->getRepository('User')->findOneBy(array('nickname' => 'romanb')); $user = $dm->getRepository('User')->findOneBy(array('nickname' => 'romanb'));
.. notice:: .. note::


Querying by simple conditions only works for documents with indexed fields. Querying by simple conditions only works for documents with indexed fields.


Expand Down

0 comments on commit 11d6abb

Please sign in to comment.