Coder Social home page Coder Social logo

doctrinecouchdbbundle's Introduction

Doctrine CouchDB Bundle

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.

doctrinecouchdbbundle's People

Contributors

beberlei avatar bangpound avatar stof avatar patromo avatar dbu avatar lsmith77 avatar tatsh avatar tolry avatar bamarni avatar seldaek avatar ruian avatar nicolas-grekas avatar saem avatar treffynnon avatar asimlqt avatar hxtpoe avatar

Watchers

ALEXEY KRUCHENOK avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.