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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:54:01+00:00 2026-06-18T08:54:01+00:00

Trying to run the command line tool w/ odm:schema:create and I’m getting errors like:

  • 0

Trying to run the command line tool w/ odm:schema:create and
I’m getting errors like:

"[Semantical Error] The annotation "@Document" in class Company_Model_Auth was never imported. Did you maybe forget to add a "use" statement for this annotation?" and
"[Semantical Error] The annotation "@EmbeddedDocument" in class Company_Model_Auth was never imported. Did you maybe forget to add a "use" statement for this annotation?"

as well as others, basically for every annotation.

When I add “use \Doctrine\ODM\MongoDB\Mapping\Annotations\EmbeddedDocument;” (or \Document) to the file it works and progresses to the next Model. It will then complain on the next file about the same classes missing (Document / EmbeddedDocument and any other annotations) . Is it expected that I would have to add the use statements to every file?

Here is how I am building my DocumentManager::

public function _initDm() 
{
        AnnotationDriver::registerAnnotationClasses();
        $config = new Configuration();
        $config->setProxyDir(APPLICATION_PATH . '/../data/Proxies');
        $config->setProxyNamespace('Proxies');
        $config->setHydratorDir(APPLICATION_PATH . '/../data/Hydrators');
        $config->setHydratorNamespace('Hydrators');
        $config->setMetadataDriverImpl(AnnotationDriver::create(APPLICATION_PATH . '/models'));     

        // Pull in mongo db connection options from application.ini
        $options = $this->getOption('mongo');
        $config->setDefaultDB($options['database']);

        // Create a DocumentManager and store in ZendRegistry
        $dm = DocumentManager::create(new Connection($this->_createMongoDbConnectionString($options)), $config);
        Zend_Registry::set('dm', $dm); 
}

I double checked and the ./repos/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Mapping/Annotations/DoctrineAnnotations.php file is definitely being hit and is require_once the proper annotation files.

Versions provisioned by composer:

"doctrine/common": "2.3.0-RC3",
"doctrine/mongodb": "1.0.1",
"doctrine/mongodb-odm": "1.0.0-BETA7",
"symfony/console": "2.1.*@dev",

Any help would be appreciated as I dont think I should have to add use statements to every file.

  • 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-06-18T08:54:02+00:00Added an answer on June 18, 2026 at 8:54 am

    The annotation parser does require that the annotation classes are imported before use. In lieu of explicitly importing each annotation class, you can do something like the following (lifted from the test suite):

    <?php
    
    namespace Documents;
    
    use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;
    
    /**
    * @ODM\Document
    */
    class User
    {
        /** @ODM\Id */
        protected $id;
    
        /** @ODM\Field(type="string") */
        protected $username;
    
        // Other fields follow...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to run a commands using Tf Command-Line Utility I'm getting errors when
I am trying to run in command line tool the following code: #import <Foundation/Foundation.h>
I am trying to run a java based tool using a command line syntax
I'm trying to run my Silverlight tests via a command line (eventually MSBuild) working
I'm trying out the Runtime.exec() method to run a command line process. I wrote
I'm trying to run a Java command line program from the Windows command prompt
I'm trying to test output from a command line tool. How do I 'fake'
I am trying to run a command-line command from inside my Delphi application. ShellExecute(Form1.Handle,
I'm trying to run a command-line program and piping in a file. The command
I'm trying to run a command line argument through VB.NET using the Shell() command.

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.