【问题标题】:Symfony doctrine:build-model errorsSymfony 学说:构建模型错误
【发布时间】:2011-05-06 09:17:15
【问题描述】:

我已经为我的 Symfony+doctrine 应用程序的数据库编写了我的 yaml 架构,我正试图让它来制作模型等,但它在 doctrine:build-model 上出错

$> ./symfony 学说:构建模型
>> 学说生成模型类

>> 文件+ /tmp/doctrine_schema_89653.yml

   No yml schema found in /tmp/doctrine_schema_89653.yml

我将我的架构放在config/doctrine/schema.yml 中,根据我经历过的所有教程,它应该在哪里。经过一番谷歌搜索后,我认为我的 yaml 中可能存在语法错误,但我不确定。以防万一:

Coder:
    actAs: [Timestampable]
    tableName: dormcode_coder
    columns:
        id:
            type: integer
            primary: true
            autoincrement: true
        username: string(60)
        password: string(60)
        email: string(255)
        firstname: string(60)
        lastname: string(60)
        
Client:
    actAs: [Timestampable]
    tableName: dormcode_client
    columns:
        id:
            type: integer
            primary: true
            autoincrement: true
        username: string(60)
        password: string(60)
        email: string(255)
        firstname: string(60)
        lastname: string(60)

Project:
    actAs: [Timestampable]
    tableName: dormcode_project
    columns:
        id:
            type: integer
            primary: true
            autoincrement: true
        client_id: integer
        title: string(255)
        briefdesc: clob
        spec: clob
        coder_id: 
            type: integer
            notnull: false
            default: null
        paytype: string(30)
        negotiable: 
            type: bool
            default: false
        complete: 
            type: bool
            default: false
    relations:
        Coder:
            foreignType: one
        Client:
            foreignType: one

Iteration:
    actAs: [Timestampable]
    tableName: dormcode_iteration
    columns:
        id:
            type: integer
            primary: true
            autoincrement: true
        ordernum: integer
        description: clob
        project_id: integer
    relations:
        Project:
            foreignAlias: Iterations

我不确定还会有什么,有谁知道其他类型的事情可能会导致该错误吗?这真的没有意义......

编辑:我刚刚在 /tmp 中查找了该文件,它就在那里。它继续{ } 就是这样。

【问题讨论】:

    标签: database symfony1 doctrine yaml


    【解决方案1】:

    是的,最近也出现了同样的错误,很麻烦。它所做的是试图加载一个旧的临时文件,而不是你希望它使用的那个:

    “在 /tmp/doctrine_schema_89653.yml 中找不到 yml 架构”

    找到这个临时文件夹(我在 Windows 上运行 XAMPP,所以我的在 XAMPP 文件夹中),从那里删除所有旧模式文件,然后重新构建。您可能需要重复执行此操作,因为每次都会创建一个临时文件。

    【讨论】:

    • 人力资源部。我尝试了几次,但无济于事。几乎就像它没有认识到我在那里有一个架构,因为该文件只有{ }
    • 好,我只用最新版本的 symfony 1.4 / 学说得到它。我之前的版本没有这个问题。
    【解决方案2】:

    我看到您的 schema.yml 设置了 4 个空格作为缩进。我的总是有 2 个空格。你可以试试。

    我还从 lib 文件夹中删除了所有生成的类(例如 /lib/models/doctrine/* 和表单(不是 BaseForm.class.php)和过滤器,因为 symfony 首先生成模型,然后从那里生成 sql 和然后将sql插入db中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-09
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      相关资源
      最近更新 更多