GithubHelp home page GithubHelp logo

rikaix / doctrineormmodule Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doctrine/doctrineormmodule

1.0 1.0 0.0 203 KB

Zend Framework 2 Module for Doctrine ORM

Home Page: http://www.doctrine-project.org/jira

doctrineormmodule's Introduction

DoctrineORM Module for Zend Framework 2

Master: Build Status

The DoctrineORMModule module intends to integrate Doctrine 2 ORM with Zend Framework 2 quickly and easily. The following features are intended to work out of the box:

  • Doctrine ORM support
  • Multiple ORM entity managers
  • Multiple DBAL connections
  • Support reuse existing PDO connections in DBAL

Requirements

Zend Framework 2

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org. To achieve the task, it currently uses OcraComposer to integrate your application with composer. This may change in future.

Installation steps

  1. cd my/project/directory

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

    {
        "require": {
            "doctrine/DoctrineORMModule": "dev-master"
        }
    }
  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)

    'OcraComposer',
    'DoctrineModule',
    'DoctrineORMModule',
  6. drop vendor/doctrine/DoctrineORMModule/config/module.doctrine_orm.local.config.php.dist into your application's config/autoload directory, rename it to module.doctrine_orm.local.config.php and make the appropriate changes.

  7. create directory my/project/directory/data/DoctrineORMModule/Proxy 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 entity manager using the following di alias:

<?php
$em = $this->getLocator()->get('Doctrine\ORM\EntityManager');

Injection

You can also inject the EntityManager directly in your controllers/services:

class MyController extends \Zend\Mvc\Controller\ActionController
{
    public function __construct(\Doctrine\ORM\EntityManager $em) {
        $this->em = $em;
        // now you can use the EntityManager!
    }
}

doctrineormmodule's People

Contributors

adamlundrigan avatar bostjanob avatar guilhermeblanco avatar ocramius avatar tobre6 avatar zluiten avatar

Stargazers

 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.