Git Product home page Git Product logo

doctrinemongoodmmodule's Introduction

Doctrine MongoDB ODM Module for Zend Framework 2

Master: Build Status

The DoctrineMongoODMModule integrates Doctrine 2 MongoDB ODM with Zend Framework 2 quickly and easily. The following features are intended to work out of the box:

  • MongoDB support
  • Multiple document managers
  • Multiple connections
  • Support for using existing Mongo connections
  • Doctrine Cli support

Requirements

Zend Framework 2 Application Skeleton (or compatible architecture)

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.

Installation steps

  1. cd my/project/directory

  2. create a composer.json file with following contents:

    {
        "require": {
            "doctrine/doctrine-mongo-odm-module": "^1.0"
        }
    }
  3. install composer via curl -s http://getcomposer.org/installer | php (on windows, download http://getcomposer.org/installer and execute it with PHP)

  4. run php composer.phar install

  5. open my/project/directory/configs/application.config.php and add following keys to your modules (in this order)

    'DoctrineModule',
    'DoctrineMongoODMModule',
  6. copy vendor/doctrine/doctrine-mongo-odm-module/config/module.doctrine-mongo-odm.local.php.dist into your application's config/autoload directory, rename it to module.doctrine-mongo-odm.local.php and make the appropriate changes. With this config file you can configure your mongo connection, add extra annotations to register, add subscribers to the event manager, add filters to the filter collection, and drivers to the driver chain.

  7. create directory my/project/directory/data/DoctrineMongoODMModule/Proxy and my/project/directory/data/DoctrineMongoODMModule/Hydrator and make sure your application has write access to it.

Usage

Command Line

Access the Doctrine command line as following

./vendor/bin/doctrine-module

Service Locator

Access the document manager using the following service manager alias:

<?php
$dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');

Configuration

Connection section

Either server or connectionString option has to be set.

Name Default Description
server 'localhost' IP of mongod instance
port 27017 mongod port
connectionString null If the connection string is specified, it will overwrite other connection options (server,port,user,password,dbname). Still, the connection will respect the settings passed in options array.
user null If set, the client will try to authenticate with given username and password
password null If set, the client will try to authenticate with given username and password
dbname null If dbname is not specified, "admin" will be used for authentication. Also, specifiing dbname affecs the defaultDB configuration option, if that's not specified explicitly.
options array() Array with connection options. More detailed description in http://www.php.net/manual/en/mongoclient.construct.php

doctrinemongoodmmodule's People

Contributors

adamh114 avatar adrienbrault avatar alcaeus avatar andreasrs avatar bilge avatar dorongutman avatar fabiocarneiro avatar gianarb avatar jaepilcyan avatar jhuet avatar jmikola avatar koubas avatar levofski avatar malarzm avatar markchalloner avatar michaelmoussa avatar michalbundyra avatar mikesimonson avatar neilime avatar ocramius avatar prolic avatar rieschl avatar romankonz avatar smolnikov avatar spiffyjr avatar superdweebie avatar theq86 avatar tomhanderson avatar vbarinov avatar

Watchers

 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.