doctrine/couchdb-odm-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Symfony2 Doctrine CouchDB Bundle

Maintainers

👁 beberlei

Package info

github.com/doctrine/DoctrineCouchDBBundle

Homepage

Type:symfony-bundle

pkg:composer/doctrine/couchdb-odm-bundle

Statistics

Installs: 18 535

Dependents: 0

Suggesters: 9

Stars: 49

Open Issues: 7

v2.1-alpha1 2015-09-02 12:04 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

LGPL 5edd1117d2ddc05b512f15f9ba8cc093cc65adfc

  • Benjamin Eberlei <kontakt.woop@beberlei.de>
  • Lukas Kahwe Smith <smith.woop@pooteeweet.org>

persistencecouchdbsymfony

This package is auto-updated.

Last update: 2024-02-12 02:10:31 UTC


README

This bundle integrates Doctrine CouchDB ODM and Clients into Symfony2.

STABILITY: Alpha

Installation

  • composer require doctrine/couchdb-odm-bundle
  • Add Doctrine\Bundle\CouchDBBundle\DoctrineCouchDBBundle to your Kernel#registerBundles() method
  • If you do not use composer, do not forget to add autoloader for the Doctrine\CouchDB, Doctrine\ODM\CouchDB and Doctrine\Bundle namespaces

To use the annotations, register them in your app/autoload.php file:

use Doctrine\Common\Annotations\AnnotationRegistry;
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));

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.