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

  • Home
  • SEARCH
  • 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 1020327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:09:05+00:00 2026-05-16T11:09:05+00:00

if i do integrate Zend Framework 1.10 with Doctrine 2 where do i put

  • 0

if i do integrate Zend Framework 1.10 with Doctrine 2 where do i put my Doctrine Models/Entities and Proxies? i thought of the /application or the /library directories. if i do put in the /library directory tho, will it interfere with ZF autoloading classes from there since the classes there will be using PHP 5.3 namespaces vs PEAR style namespaces.

  • 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-16T11:09:06+00:00Added an answer on May 16, 2026 at 11:09 am

    I’m working on an application that integrates Doctrine 2 with ZF1.10 also.You don’t need to use the Doctrine auto loader at all.

    1) In your application.ini file add the following line (assuming you have Doctrine installed in your library folder (same as the Zend folder):

    autoloadernamespaces.doctrine = "Doctrine"
    

    2) Create a doctrine or entitymanager resource. In your ini file:

    resources.entitymanager.db.driver = "pdo_mysql"
    resources.entitymanager.db.user = "user"
    resources.entitymanager.db.dbname = "db"
    resources.entitymanager.db.host = "localhost"
    resources.entitymanager.db.password = "pass"
    resources.entitymanager.query.cache = "Doctrine\Common\Cache\ApcCache"
    resources.entitymanager.metadata.cache = "Doctrine\Common\Cache\ApcCache"
    resources.entitymanager.metadata.driver = "Doctrine\ORM\Mapping\Driver\AnnotationDriver"
    resources.entitymanager.metadata.proxyDir = APPLICATION_PATH "/../data/proxies"
    resources.entitymanager.metadata.entityDir[] = APPLICATION_PATH "/models/entity"
    

    3) Next, you will need to bootstrap it. I added a resource class in my resources folder. Make sure you map to the folder in your ini file:

    pluginPaths.Application_Resource_ = APPLICATION_PATH "/resources"
    

    Then your resource class…

    class Application_Resource_EntityManager 
    extends Zend_Application_Resource_ResourceAbstract
    {
        /**
         * @var Doctrine\ORM\EntityManager
         */
        protected $_em;
    
        public function init()
        {
            $this->_em = $this->getEntityManager();
            return $this->_em;
        }
    
        public function getEntityManager()
        {
            $options = $this->getOptions(); 
            $config = new \Doctrine\ORM\Configuration();
            $config->setProxyDir($options['metadata']['proxyDir']);
            $config->setProxyNamespace('Proxy');
            $config->setAutoGenerateProxyClasses((APPLICATION_ENV == 'development'));
            $driverImpl = $config->newDefaultAnnotationDriver($options['metadata']['entityDir']);
            $config->setMetadataDriverImpl($driverImpl);
            $cache = new Doctrine\Common\Cache\ArrayCache();
            $config->setMetadataCacheImpl($cache);
            $config->setQueryCacheImpl($cache);
    
            $evm = new Doctrine\Common\EventManager();
            $em = Doctrine\ORM\EntityManager::create($options['db'],$config,$evm);
    
            return $em;
        }
    }
    

    The doctrine 2 entity manager is now available to your application. In your controller you can grab it like so:

    $bootstrap = $this->getInvokeArg('bootstrap');
    $em = $bootstrap->getResource('entitymanager');
    

    I am sure this will help somebody 🙂

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

Sidebar

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.