是否可以在Propel 1.6中使用test_schema.xml?

时间:2012-08-03 10:44:13

标签: symfony propel

我正在使用Symfony-2.0和Propel 1.6。

出于测试目的,我想要单独的模式文件。原因是,使用我当前的架构,无法加载转储装置,因为PK和自动增量导致进程失败:

app/console propel:fixtures:load --env=test
Use connection named default in test environment.
No SQL fixtures found.
No XML fixtures found.


  [Propel] Exception                                                 

  Cannot insert a value for auto-increment primary key (article.ID)

如果我可以定义test_schema.xml我将从中生成没有autoIncrement="true"属性的模型,然后将加载灯具。


如何强制Propel在测试环境中使用test_schema.xml

或者可能还有其他方法如何正确加载灯具?

1 个答案:

答案 0 :(得分:1)

您可以使用propel propel.schema.dir和propel.default.schema.basename构建属性来指定架构文件的位置及其名称:

# app/config/config_test.yml
propel:
    build_properties:
# The directory where Propel expects to find your `schema.xml` file.
        propel.schema.dir = //wherever
# The schema base name
        propel.default.schema.basename = schema
相关问题