代码之家  ›  专栏  ›  技术社区  ›  The.Anti.9

Symfony原则:构建模型错误

  •  1
  • The.Anti.9  · 技术社区  · 14 年前

    我已经为Symfony+条令应用程序的数据库编写了我的yaml模式,我正试图让它生成模型等等,但是它在 doctrine:build-model

    $>/symfony原则:构建模型
    >gt;条令生成模型类

    >>

       No yml schema found in /tmp/doctrine_schema_89653.yml
    

    我加入了我的计划 config/doctrine/schema.yml ,根据我所经历的所有教程,它应该在哪里。经过一些谷歌搜索,我想可能有语法错误在我的山药,但我不确定。这里只是以防万一:

    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中查找了文件,它就在那里。它继续 { }

    2 回复  |  直到 14 年前
        1
  •  2
  •   Tom    14 年前

    是啊,最近也犯了同样的错误,真讨厌。它所做的是尝试加载一个旧的临时文件,而不是您希望它使用的文件:

    “在中找不到yml架构 /tmp/条令模式 "

        2
  •  0
  •   dazz    14 年前

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

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