Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7403161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:59:04+00:00 2026-05-29T04:59:04+00:00

I would like to start developing with Zend Framework and I would like to

  • 0

I would like to start developing with Zend Framework and I would like to use zf2. Since I use Doctrine 2, can you suggest some tutorials to help me to integrate it in zf2? Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:59:09+00:00Added an answer on May 29, 2026 at 4:59 am

    last time checked: ZF2.2.*, DoctrineORMModule 0.7.

    Official Module

    You may want to load DoctrineORMModule via composer:

    • add doctrine/doctrine-orm-module to your composer.json‘s require (example code after list bcs of formatting problems)
    • run php composer.phar install
    • create the directory ./data/DoctrineORMModule/Proxy and ensure write access for your application
    • configure doctrine via your applications /config/autoload to give the module the project-specific settings (database etc)
    • configure doctrine’s entity mapping in your modules config.php
    • add an entity to your project
    • add DoctrineORMModule and DoctrineModule to your config/application.config.php
    • run the cli tool to generate your tables ./vendor/bin/doctrine-module orm:schema-tool:create

    I strongly discourage you from not using composer, as it is an easy way to install dependencies and have the autoloaders all set up. Also ZF2 ships via composer by default.

    Example Code

    composer.json

    {  
        "require" : {  
            "php": ">=5.3.3",  
            "zendframework/zendframework": "2.*"                
            "doctrine/doctrine-orm-module": "0.*"                
        }  
    }  
    

    entities settings

    <?php
    return array(
        'doctrine' => array(
            'driver' => array(
                // defines an annotation driver with two paths, and names it `my_annotation_driver`
                'my_annotation_driver' => array(
                    'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                    'cache' => 'array',
                    'paths' => array(
                        'path/to/my/entities',
                        'another/path'
                    ),
                ),
    
                // default metadata driver, aggregates all other drivers into a single one.
                // Override `orm_default` only if you know what you're doing
                'orm_default' => array(
                    'drivers' => array(
                        // register `my_annotation_driver` for any entity under namespace `My\Namespace`
                        'My\Namespace' => 'my_annotation_driver'
                    )
                )
            )
        )
    );
    

    A gotcha to be aware of: The paths to your entites should be fully qualified. Best start with __DIR__, else things will break (Every new project I wonder why the command line tool doesn’t work until I find this error … 😉

    connection settings

    <?php
    return array(
        'doctrine' => array(
            'connection' => array(
                // default connection name
                'orm_default' => array(
                    'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
                    'params' => array(
                        'host'     => 'localhost',
                        'port'     => '3306',
                        'user'     => 'username',
                        'password' => 'password',
                        'dbname'   => 'database',
                    )
                )
            )
        ),
    );
    

    All code examples are part of the official doctrine module readme

    Further Reading:

    Marco Pivetta made a wonderful presentation about doctrine-module usage, which I recommend to everybody using this module.

    Jason Grimes wrote a tutorial featured on phpdeveloper.org which should help installing doctrine, before there was an official module.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been developing my first iPhone app part-time and would like to start using
I would like start with .NET Micro Framework as my hobby project. What hardware
I would like to start learning SQL Server 2005 on my own. Can anyone
I would like to start developing an application for Ipad (a simple one). My
I would like to start developing a simple Workflow application in Sharepoint. What files
I would like to start developing mobile-friendly versions of websites for my clients, however,
Hello I would like to start developing a lifeRay theme and am a little
I'm developing an android widget and i would like to start a certain activity
I would like to start developing my cocoa app on two different machines. I'm
I would like to start programming for symbianOS and have some starter questions.I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.