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

The Archive Base Latest Questions

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

I’m attempting to use Doctrine ORM for the first time, and I’m following the

  • 0

I’m attempting to use Doctrine ORM for the first time, and I’m following the configuration found here.

Following these steps directly results in the following error:

Warning: class_parents() [function.class-parents]: Class
MyProject\Model\User does not exist
and could not be loaded in
/opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php
on line 222

Warning: array_reverse() expects parameter 1 to be array, boolean given
in
/opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php
on line 222

Warning: Invalid argument supplied for foreach() in
/opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php
on line 222

Fatal error: Uncaught exception ‘ReflectionException’ with message
‘Class MyProject\Model\User does not
exist’ in
/opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadata.php:67

Stack trace:

#0 /opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadata.php(67):
ReflectionClass->__construct(‘MyProject\Model…’)

#1 /opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php(350):
Doctrine\ORM\Mapping\ClassMetadata->__construct(‘MyProject\Model…’)

#2 /opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php(260):
Doctrine\ORM\Mapping\ClassMetadataFactory->newClassMetadataInstance(‘MyProject\Model…’)

#3 /opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadataFactory.php(169):
Doctrine\ORM\Mapping\ClassMetadataFactory->loadMetadata(‘MyProject\Model…’)

#4 /opt/local/lib/php/Doctrine/ORM/EntityManager.php(247):
Doctrine\ORM\Mapping\ClassMetadataFactory->getMetadataFor(‘MyProject\Model…’)

#5 /opt/local/lib/php/Doctrine/ORM/EntityManager.php(563):
Doctrine\ORM\EntityManager->getClassMetadata(‘MyProject\Model…’)

#6 /opt in /opt/local/lib/php/Doctrine/ORM/Mapping/ClassMetadata.php
on line 67

This error goes away, and the code works perfectly if in the sample code, I add the following line (denoted with the comment below):

$driverImpl = $config->newDefaultAnnotationDriver('/path/to/lib/MyProject/Entities');
$driverImpl->getAllClassNames();  // **MY ADDED LINE**
$config->setMetadataDriverImpl($driverImpl);

There is nothing that mentions this call being required to get the sample code to work; it was just something I happened to stumble across while echoing some info to the screen while trying to see where my error is occurring.

Is there a reason this call is needed (and why it’s not mentioned in the sample code)? Is there something else that should instead be called, which is the root cause to my original error?

(I can post more code as required, I’m just not positive what is most helpful in soliving this since it’s my first time using Doctrine.)

EDIT: I neglected to mention the line on which the error actually occurs:

$user = $em->find('MyProject\Model\User', 1);
  • 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-18T22:05:11+00:00Added an answer on May 18, 2026 at 10:05 pm

    It sounds like you do not have a class loader set up for your project correctly:

    $classloader = new \Doctrine\Common\ClassLoader('MyProject', '/path/to/lib/');
    $classloader->register();
    

    The reason calling getAllClassNames() is fixing your issue is because it traverses all of the directories and files inside of /path/to/lib/MyProject/Entities and includes them. Obviously this is slow and isn’t recommended.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.