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 4611696
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:18:10+00:00 2026-05-22T01:18:10+00:00

When trying to run a simple command $msg = $this->_em->find(Entities\Message, 1); in my IndexController

  • 0

When trying to run a simple command $msg = $this->_em->find(“Entities\Message”, 1); in my IndexController I get the following errors:

( ! ) Warning: class_parents() [function.class-parents]: Class Entities\Message does not exist and could not be loaded in C:\wamp\www\KosherOven\library\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Call Stack
#   Time    Memory  Function    Location
1   0.0006  372272  {main}( )   ..\index.php:0
2   0.0918  5254808 Zend_Application->run( )    ..\index.php:27
3   0.0918  5254808 Zend_Application_Bootstrap_Bootstrap->run( )    ..\Application.php:366
4   0.0919  5254864 Zend_Controller_Front->dispatch( )  ..\Bootstrap.php:97
5   0.1088  6406328 Zend_Controller_Dispatcher_Standard->dispatch( )    ..\Front.php:954
6   0.1218  6758576 Zend_Controller_Action->dispatch( ) ..\Standard.php:295
7   0.1219  6761896 IndexController->indexAction( ) ..\Action.php:513
8   0.1219  6761992 Doctrine\ORM\EntityManager->find( ) ..\IndexController.php:16
9   0.1225  6764176 Doctrine\ORM\EntityManager->getRepository( )    ..\EntityManager.php:344
10  0.1225  6764240 Doctrine\ORM\EntityManager->getClassMetadata( ) ..\EntityManager.php:567
11  0.1225  6764240 Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor( )    ..\EntityManager.php:251
12  0.1226  6764272 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata( )  ..\ClassMetadataFactory.php:169
13  0.1226  6764456 Doctrine\ORM\Mapping\ClassMetadataFactory->getParentClasses( )  ..\ClassMetadataFactory.php:245
14  0.1226  6764608 class_parents ( )   ..\ClassMetadataFactory.php:222

( ! ) Warning: array_reverse() expects parameter 1 to be array, boolean given in C:\wamp\www\KosherOven\library\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Call Stack
#   Time    Memory  Function    Location
1   0.0006  372272  {main}( )   ..\index.php:0
2   0.0918  5254808 Zend_Application->run( )    ..\index.php:27
3   0.0918  5254808 Zend_Application_Bootstrap_Bootstrap->run( )    ..\Application.php:366
4   0.0919  5254864 Zend_Controller_Front->dispatch( )  ..\Bootstrap.php:97
5   0.1088  6406328 Zend_Controller_Dispatcher_Standard->dispatch( )    ..\Front.php:954
6   0.1218  6758576 Zend_Controller_Action->dispatch( ) ..\Standard.php:295
7   0.1219  6761896 IndexController->indexAction( ) ..\Action.php:513
8   0.1219  6761992 Doctrine\ORM\EntityManager->find( ) ..\IndexController.php:16
9   0.1225  6764176 Doctrine\ORM\EntityManager->getRepository( )    ..\EntityManager.php:344
10  0.1225  6764240 Doctrine\ORM\EntityManager->getClassMetadata( ) ..\EntityManager.php:567
11  0.1225  6764240 Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor( )    ..\EntityManager.php:251
12  0.1226  6764272 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata( )  ..\ClassMetadataFactory.php:169
13  0.1226  6764456 Doctrine\ORM\Mapping\ClassMetadataFactory->getParentClasses( )  ..\ClassMetadataFactory.php:245
14  0.1247  6774560 array_reverse ( )   ..\ClassMetadataFactory.php:222

( ! ) Warning: Invalid argument supplied for foreach() in C:\wamp\www\KosherOven\library\Doctrine\ORM\Mapping\ClassMetadataFactory.php on line 222
Call Stack
#   Time    Memory  Function    Location
1   0.0006  372272  {main}( )   ..\index.php:0
2   0.0918  5254808 Zend_Application->run( )    ..\index.php:27
3   0.0918  5254808 Zend_Application_Bootstrap_Bootstrap->run( )    ..\Application.php:366
4   0.0919  5254864 Zend_Controller_Front->dispatch( )  ..\Bootstrap.php:97
5   0.1088  6406328 Zend_Controller_Dispatcher_Standard->dispatch( )    ..\Front.php:954
6   0.1218  6758576 Zend_Controller_Action->dispatch( ) ..\Standard.php:295
7   0.1219  6761896 IndexController->indexAction( ) ..\Action.php:513
8   0.1219  6761992 Doctrine\ORM\EntityManager->find( ) ..\IndexController.php:16
9   0.1225  6764176 Doctrine\ORM\EntityManager->getRepository( )    ..\EntityManager.php:344
10  0.1225  6764240 Doctrine\ORM\EntityManager->getClassMetadata( ) ..\EntityManager.php:567
11  0.1225  6764240 Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor( )    ..\EntityManager.php:251
12  0.1226  6764272 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata( )  ..\ClassMetadataFactory.php:169
13  0.1226  6764456 Doctrine\ORM\Mapping\ClassMetadataFactory->getParentClasses( )  ..\ClassMetadataFactory.php:245

( ! ) Fatal error: Cannot redeclare class Message in C:\wamp\www\KosherOven\application\models\Entities\Message.php on line 9
Call Stack
#   Time    Memory  Function    Location
1   0.0006  372272  {main}( )   ..\index.php:0
2   0.0918  5254808 Zend_Application->run( )    ..\index.php:27
3   0.0918  5254808 Zend_Application_Bootstrap_Bootstrap->run( )    ..\Application.php:366
4   0.0919  5254864 Zend_Controller_Front->dispatch( )  ..\Bootstrap.php:97
5   0.1088  6406328 Zend_Controller_Dispatcher_Standard->dispatch( )    ..\Front.php:954
6   0.1218  6758576 Zend_Controller_Action->dispatch( ) ..\Standard.php:295
7   0.1219  6761896 IndexController->indexAction( ) ..\Action.php:513
8   0.1219  6761992 Doctrine\ORM\EntityManager->find( ) ..\IndexController.php:16
9   0.1225  6764176 Doctrine\ORM\EntityManager->getRepository( )    ..\EntityManager.php:344
10  0.1225  6764240 Doctrine\ORM\EntityManager->getClassMetadata( ) ..\EntityManager.php:567
11  0.1225  6764240 Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor( )    ..\EntityManager.php:251
12  0.1226  6764272 Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata( )  ..\ClassMetadataFactory.php:169
13  0.1257  6774344 Doctrine\ORM\Mapping\ClassMetadataFactory->newClassMetadataInstance( )  ..\ClassMetadataFactory.php:260
14  0.1301  7172352 Doctrine\ORM\Mapping\ClassMetadata->__construct( )  ..\ClassMetadataFactory.php:351
15  0.1301  7172592 ReflectionClass->__construct( ) ..\ClassMetadata.php:67
16  0.1302  7172896 Doctrine\Common\ClassLoader->loadClass( )   ..\ClassLoader.php:0
17  0.1305  7182920 require( 'C:\wamp\www\KosherOven\application\models\Entities\Message.php' ) ..\ClassLoader.php:148

Here is my doctrine bootstrap code:

protected function _initDoctrine()
{
    /* Autoload classes */
    require_once 'Doctrine/Common/ClassLoader.php';
    $classLoader = new Doctrine\Common\ClassLoader('Doctrine');
    $classLoader->register();
    // load the doctrine class loader for Symfony library components
    $classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
    $classLoader->register();
    $classLoader = new \Doctrine\Common\ClassLoader('Entities', APPLICATION_PATH . '/models');
    $classLoader->register();

    /* Choose cache */

    if (APPLICATION_ENV == "development") {
        $cache = new \Doctrine\Common\Cache\ArrayCache;
    } else {
        //$cache = new \Doctrine\Common\Cache\ApcCache;
        $cache = new \Doctrine\Common\Cache\ArrayCache;
    }

    $config = new \Doctrine\ORM\Configuration;
    $config->setMetadataCacheImpl($cache);

    $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/configs/doctrine/Mapping');
    $config->setMetadataDriverImpl($driverImpl);
    $config->setQueryCacheImpl($cache);
    $config->setProxyDir(APPLICATION_PATH . '/Proxies');
    $config->setProxyNamespace('Proxies');

    if (APPLICATION_ENV == "development") {
        $config->setAutoGenerateProxyClasses(true);
    } else {
        $config->setAutoGenerateProxyClasses(false);
    }

    $configObj = $this->_initConfig();

    $connectionOptions = array(
        'driver'   => $configObj->database->adapter,
        'dbname'   => $configObj->database->params->dbname,
        'host'     => $configObj->database->params->host,
        'user'     => $configObj->database->params->username,
        'password' => $configObj->database->params->password
    );
    $em = \Doctrine\ORM\EntityManager::create($connectionOptions, $config);

    Zend_Registry::set('em', $em);
}

I am using Doctrine 2.0.4.

I can’t think of any other info to provide, but I would be happy to add more information if needed.

  • 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-22T01:18:11+00:00Added an answer on May 22, 2026 at 1:18 am

    Make sure you have the following class in application/models/Entities/Message.php

    namespace Entities;
    
    /**
     * @Entity
     */
    class Message
    {
        // ...
    

    Also, I’m not sure about this line

    // load the doctrine class loader for Symfony library components
    $classLoader = new \Doctrine\Common\ClassLoader('Symfony', 'Doctrine');
    

    Isn’t that saying the Symfony namespace / folder is in the Doctrine directory?

    Edit: My guess would be it should look like this

    $classLoader = new \Doctrine\Common\ClassLoader('Symfony');
    

    UPDATE

    I think I see what’s missing. You aren’t telling the annotation driver where to find your entities.

    I think this line

    $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . ‘/configs/doctrine/Mapping’);

    should be

    $driverImpl = $config->newDefaultAnnotationDriver(APPLICATION_PATH . '/models/Entities');
    

    See http://www.doctrine-project.org/docs/orm/2.0/en/reference/configuration.html

    I highly recommend you check out the Bisna integration from Guilherme Blanco – https://github.com/guilhermeblanco/ZendFramework1-Doctrine2

    I also have a sort of ZF/Doctrine2 app skeleton here that you’re welcome to look at – https://github.com/philBrown/ZFDoctrineSkeleton

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

Sidebar

Related Questions

I am trying to run this dreadfully simple command in Bash java -cp nasa-top-secret.jar
I got this error when I am trying to run a simple PhP script
I'm trying to run a simple Get-WmiObject call in PowerShell. Get-WmiObject -computerName $srv -namespace
I am trying get my first simple project in rails to run. I have
Hello I'm trying to run a simple sql command on a DB from MS
I'm trying to run a c++ 2d array (pretty simple file) and it works
I'm trying to run some queries to get rid of XSS in our database
I need to write a relatively simple command line C++ program to be run
When using a simple command line svn client, if you run update you can
Trying to run a simple Hello World C++ program on Eclipse (Galileo) CDT plugin

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.