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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:50:14+00:00 2026-06-18T12:50:14+00:00

I have clean project ZendSkeletonApplication with integrated Doctrine 2 module doctrine-orm-module etc via Composer.

  • 0

I have clean project ZendSkeletonApplication with integrated Doctrine 2 module “doctrine-orm-module” etc via Composer. Doctrine CLI works from vendor/bin.

I have ‘Application’ and ‘Blog’ module, my module config:

<?php
namespace Blog;

return array(
  'router' => array(
    'routes' => array(
      'post' => array(
        'type' => 'segment',
        'options' => array(
          'route' => '/post[/:action][/:id]',
          'constraints' => array(
            'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
            'id' => '[0-9]+',
          ),
          'defaults' => array(
            'controller' => 'Blog\Controller\Post',
            'action' => 'index',
          ),
        ),
      ),
    ),
  ),
  'controllers' => array(
    'invokables' => array(
      'Blog\Controller\Post' => 'Blog\Controller\PostController'
    ),
  ),
  'view_manager' => array(
    'template_path_stack' => array(
      'blog' => __DIR__ . '/../view',
    ),
  ),
  'doctrine' => array(
    'driver' => array(
      __NAMESPACE__ . '_driver' => array(
        'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
        'cache' => 'array',
        'paths' => array(__DIR__ . '/../src/' . __NAMESPACE__ . '/Entity')
      ),
      'orm_default' => array(
        'drivers' => array(
          __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
        )
      )
    )
    )
);

How to generate Entities from YAML files each module and how to config my modules arrays to use YAML? For example I have my all .yml files in ZendSkeletonApplication/mapping/yml and few .yml files have definitions of Blog module entities and few have definitions of Application module entities.

My entities are in Blog/src/Blog/Entity folder for blog module. All I want its just by one call in Doctrine CLI generate-entities create all Entities each module from all .yml files which are placed in mapping/yml folder? Is it possible? Can anybody provide simple example with doctrine config?

  • 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-18T12:50:15+00:00Added an answer on June 18, 2026 at 12:50 pm

    The following approach quick and dirty approach works for me:

    1. Add the following lines to …vendor\doctrine\doctrine-module\bin\doctrine-module.php:

      $driverImpl = new \Doctrine\ORM\Mapping\Driver\YamlDriver(
           array("YOUR_PATH_TO_YAML_FILES"));
      /* @var $em \Doctrine\ORM\EntityManager */
      $em = $application->getServiceManager()->get('doctrine.entitymanager.orm_default');
      $em->getConfiguration()->setMetadataDriverImpl($driverImpl);
      
      //...old code...
      /* @var $cli \Symfony\Component\Console\Application */        
      $cli = $application->getServiceManager()->get('doctrine.cli');
      
    2. Now you can this doctrine-module.php on command line interface to call

       orm:generate-entities --generate-annotations=1 PATH_TO_YOUR_ENTITY_CLASSES
      

      Be careful with namespaces. The YAML driver expects namespace.entity.dcm.yml to be the the name of the \Namespace\Entity YAML file. The Tool will create PATH_TO_YOUR_ENTITY_CLASSES\Namespace\Entity.php for you.

    If you want to use this approach more regularly it might be cleaner to extend Doctrine\ORM\Tools\Console\CommandGenerateEntitiesCommand along these lines and add a new command to the cli.

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

Sidebar

Related Questions

I have integrated in Hudson a maven 3 project calling following sequence: clean tomcat:redeploy
I have a Jenkins build which builds a maven project with -PmyProfile clean package
For doing builds, packaging files up, etc, it's needed to have a completely clean
I have simple algorithm that clean the whitespace from half string until end. Here
I use Django 1.3. I have a clean project with: settings.py import os, sys
I use eclipse and the maven plugin. I have a big multi-module project (~6
What's the difference between Eclipse/Project/Clean... and Eclipse/Project/Refresh (F5) I often have to rebuild my
I have to clean up an old project and general knowledge here is that
Resources$NotFoundException: File res/color/dark.xml from drawable resource I have that error. I tried clean project.
I have a objective c/c++ project under iOS, moving it from OS/X and I

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.