Developed with love by KnpLabs Hire us for your project!
36

DoctrineCouchDBBundle

by doctrine

Symfony Bundle for DoctrineCouchDB

Doctrine CouchDB Bundle

This bundle integrates Doctrine CouchDB ODM and Clients into Symfony2.

STABILITY: Alpha

Installation

  • Grab this repository and Doctrine CouchDB ODM into your Symfony project
  • Add Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle to your Kernel#registerBundles() method
  • Add autoloader for Doctrine\CouchDB, Doctrine\ODM\CouchDB and Doctrine\Bundle namespaces

Documentation

See the Doctrine CouchDB ODM documentation for more information.

Configuration

The configuration is similar to Doctrine ORM and MongoDB configuration for Symfony2 as its based
on the AbstractDoctrineBundle aswell:

doctrine_couch_db:
  client:
    dbname: symfony
  odm:
    auto_mapping: true

To dump the configuration reference of this bundle

php app/console config:dump-reference doctrine_couch_db

Annotations

An example of how to use annotations with CouchDB and Symfony:

<?php
namespace Acme\DemoBundle\CouchDocument;

use Doctrine\ODM\CouchDB\Mapping\Annotations as CouchDB;

/**
 * @CouchDB\Document
 */
class User
{
    /** @CouchDB\Id */
    private $id;
}

Services

You can access to CouchDB services:

<?php

namespace Acme\DemoBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class DefaultController extends Controller
{
    public function indexAction()
    {
        $client = $this->container->get('doctrine_couchdb.client.default_connection');
        $documentManager = $this->container->get('doctrine_couchdb.odm.default_document_manager');
    }
}

View directories

In @YourBundle/Resources/couchdb/ you can add design documents and corresponding views and have Doctrine
CouchDB register them up automatically. For example if you had a design doc "foo" and a view "bar" you could
add the following files and directories:

Resources/couchdb/
└── foo/
    └── views/
        └── bar/
            ├── map.js
            └── reduce.js

You can then update this design document from the CLI by calling:

./app/console doctrine:couchdb:update-design-doc foo

Where foo is the name of the design document.

Copyright (c) 2010-2012 Doctrine

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

This software consists of voluntary contributions made by many individuals
and is licensed under the LGPL. For more information, see
<http://www.doctrine-project.org>.
doctrine_couch_db:
client: # Required
default_connection: ~
connections:

# Prototype
name:
dbname: ~
host: localhost
port: 5984
user: ~
password: ~
ip: ~
logging: false
type: ~
odm:
default_document_manager: ~
auto_generate_proxy_classes: false
proxy_dir: %kernel.cache_dir%/doctrine/CouchDBProxies
proxy_namespace: CouchDBProxies
document_managers:

# Prototype
name:
metadata_cache_driver:
type: array # Required
host: ~
port: ~
instance_class: ~
class: ~
connection: ~
auto_mapping: false
mappings:

# Prototype
name:
mapping: true
type: ~
dir: ~
alias: ~
prefix: ~
is_bundle: ~
design_documents:

# Prototype
name:
className: ~
options: ~
lucene_handler_name: false
uuid_buffer_size: 20
view_name: symfony
all_or_nothing_flush: true
  • bundle seems to work with symfony 2.2 too
    By dbu, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago
  • Merge pull request #25 from dbu/works-with-symfony2.2
    By stof, 23 days ago