Zend Framework 1.11 - Doctrine 2.2 - 从子文件夹加载实体

时间:2012-02-08 14:01:14

标签: zend-framework doctrine-orm

我正在尝试使用Doctrine 2.2和YML实体定义设置Zend Framework项目,并对实体存储位置有疑问。

我想以下列格式存储我的实体:

|Project
    |-Application
        |-api
        |-configs
        |-controllers
        |-entities
            |-Users
                users.php
                passwords.php
            |-Products
                onshelf.php 
                offsehlf.php
        |-modules
        |-views
        |-Bootstrap.php
    |-Docs
    |-Library
    |-Public
    |-.zfproject.xml

我在“子文件夹”中加载实体时遇到问题,除非我为Entities文件夹中的每个子文件夹指定以下内容 - 在我的DoctrineEntityManager资源加载器中:

$classLoader = new \Doctrine\Common\ClassLoader('Users', APPLICATION_PATH . '/entities');
$classLoader->register();

我真的不想为每个子文件夹执行此操作,因为它会消除Doctrine命令行界面的真正“自动化”。

这是解决这个问题的唯一方法吗?还是使用子文件夹而不是“常规做法”?

0 个答案:

没有答案