使用模块化结构zend项目中的doctrine yml文件生成模型和数据库

时间:2011-03-02 11:02:08

标签: zend-framework doctrine

我一直在没有模块的项目中使用带有zend的doctrine。它工作正常。

但是现在我正在使用不同模块的zend项目。结构是那样的

application
---modules
------admin
---------models
---------controllers
---------views

我有一个yml架构

options:
    type: INNODB
    collate: utf8_general_ci
    charset: utf8
User:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    name: string(255)
    email: string(300)

我在shell上运行此命令以生成模型和db。

shell> ./doctrine build-all-reload

它直接在APPLICATION文件夹下生成模型。 虽然我想在APPLICATION中生成模型 - >模块 - > ADMIN - >楷模 夹

请指导我,我需要做什么配置才能达到上述效果。

1 个答案:

答案 0 :(得分:0)

您可以将带有'models_path'的配置数组传递给Doctrine_Cli构造函数。

$config = array(
    'models_path' => APPLICATION_PATH . '/modules/admin/models'
);

$cli = new Doctrine_Cli($config);

有关cli配置选项的更多信息,请参阅http://www.doctrine-project.org/projects/orm/1.2/docs/manual/utilities/en#command-line-interface