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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T09:49:40+00:00 2026-05-20T09:49:40+00:00

I am very new to ORM and Doctrine so please be patient with me.

  • 0

I am very new to ORM and Doctrine so please be patient with me.

I am more or less following the getting started tutorial now (just with different tables to make it more interesting). I have created two YAML files defining my schema which is very simple:

User:

User:
  type: entity
  table: users
  id:
    id:
      type: integer
      generator: AUTO
  fields:
    firstName:
      type: string
    lastName:
      type: string
    birthdate:
      type: datetime
    email:
      type: string
    username:
      type: string
    password:
      type: string
  oneToMany:
    pages:
      targetEntity: Page
      mappedBy: user

Page:

Page:
  type: entity
  table: pages
  id:
    id:
      type: integer
      generator:
        strategy: AUTO
  fields:
    name:
      type: string
    content:
      type: text
  manyToOne:
    user:
      targetEntity: User
      inversedBy: pages

Now I am trying to use the SchemaTool to create a database schema. When I run this code:

$em = Zend_Registry::get('entityManager');
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
$classes = array(
    $em->getClassMetadata('Entities\User'),
    $em->getClassMetadata('Entities\Page')
);

I get this error:

#0 C:\inetpub\wwwroot\zend\library\Doctrine\ORM\Configuration.php(150):
Doctrine\ORM\ORMException::unknownEntityNamespace('C')
#1
C:\inetpub\wwwroot\zend\library\Doctrine\ORM\Mapping\ClassMetadataFactory.php(155):
Doctrine\ORM\Configuration->getEntityNamespace('C')
#2 C:\inetpub\wwwroot\zend\library\Doctrine\ORM\EntityManager.php(247):
Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor('C:\inetpub\wwwr...')
#3
C:\inetpub\wwwroot\zend\application\modules\default\controllers\DoctrineUtilController.php(16):
Doctrine\ORM\EntityManager->getClassMetadata('C:\inetpub\wwwr...')
#4 C:\inetpub\wwwroot\zend\library\Zend\Controller\Action.php(513):
DoctrineUtilController->generateModelsAction()
#5 C:\inetpub\wwwroot\zend\library\Zend\Controller\Dispatcher\Standard.php(295):
Zend_Controller_Action->dispatch('generateModelsA...')
#6 C:\inetpub\wwwroot\zend\library\Zend\Controller\Front.php(954):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http),
Object(Zend_Controller_Response_Http))
#7 C:\inetpub\wwwroot\zend\application\Bootstrap.php(177):
Zend_Controller_Front->dispatch()
#8 C:\inetpub\wwwroot\zend\library\Zend\Application.php(366):
Bootstrap->run()
#9 C:\inetpub\wwwroot\zend\public\index.php(54): Zend_Application->run()
#10 {main}    
    $tool->createSchema($classes);

Any ideas where could be a problem?


Additional information just in case. This is how I create entity manager in the Bootstrap.php file:

protected function _initDoctrine() {
    // (1)
    $config = new \Doctrine\ORM\Configuration();

    // Proxy Configuration (2)
    $config->setProxyDir(APPLICATION_PATH.'/proxies');
    $config->setProxyNamespace('Application\Proxies');
    $config->setAutoGenerateProxyClasses(('development' === APPLICATION_ENVIRONMENT));

    // Mapping Configuration (3)
    $driverImpl = new Doctrine\ORM\Mapping\Driver\XmlDriver(APPLICATION_PATH.'/configs/mappings/yml');
    $config->setMetadataDriverImpl($driverImpl);

    // Caching Configuration (4)
    if ('development' === APPLICATION_ENVIRONMENT) {
        $cache = new \Doctrine\Common\Cache\ArrayCache();
    } else {
        $cache = new \Doctrine\Common\Cache\ApcCache();
    }
    $config->setMetadataCacheImpl($cache);
    $config->setQueryCacheImpl($cache);

    // database configuration parameters (5)
    $conn = array(
        'driver' => $this->configuration->database->adapter,
        'user' => $this->configuration->database->username,
        'password' => $this->configuration->database->password,
        'dbname' => $this->configuration->database->dbname
    );

    // obtaining the entity manager (6)
    $evm = new Doctrine\Common\EventManager();
    $this->entityManager = \Doctrine\ORM\EntityManager::create($conn, $config, $evm);
    Zend_Registry::set('entityManager', $this->entityManager);
}
  • 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-20T09:49:40+00:00Added an answer on May 20, 2026 at 9:49 am

    It seems that there is a problem with the path definitions.

    Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor('C:\inetpub\wwwr...')
    

    This shouldn’t be the absolute path, as Doctrine assumes that is the class name with namespace, so it takes that ‘C:\’ as namespace.

    So it is a problem with configuration or autoloaders.

    There is a sandbox in the Doctrine which includes a basic working configuration, you can use that as a starting point.

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

Sidebar

Related Questions

Very new to C++ and Cocos2d-x but I was just toying around with CCArray
Very new to javascript and html-type stuff. I wanted to just make a quick
Very new to FluentNHibernate, but I'm also excited about the area. I've recently started
Very new to JQuery and MVC and webdevelopment over all. I'm now trying to
I'm sure different ORM tools address the problem differently, but being brand new to
I'm working on a new project right now and thinking of using an ORM
I'm very new to ORM and I kind of understand the definition. Confusion starts
It's a very common situation, but I'm kinda new using ORM especially in Android,
Very new to python and can't understand why this isn't working. I have a
Very new to XSL (and XML for that matter), but I need to step

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.