symfony 1.4 build-schema id导致视图出现问题

时间:2011-09-16 10:45:18

标签: symfony-1.4 propel

突然之间,我遇到了通过Propel执行视图的问题。

[wrapped: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'view_total_count_for_collection.ID' in 'field list']

好吧,DUH。那是因为视图中没有实际的ID列!那你为什么围绕一个不存在的列建立一个模型呢?

这是我的schema.yml的相关部分,由propel:build-schema

生成
  view_total_count_for_collection:
    _attributes: { phpName: ViewTotalCountForCollection }
    collection_id: { phpName: CollectionId, type: INTEGER, size: '11', required: true }
    asset_count: { phpName: AssetCount, type: BIGINT, size: '21', required: true, defaultValue: '0' }
    pallet_received: { phpName: PalletReceived, type: INTEGER, size: '11', required: false }
    case_received: { phpName: CaseReceived, type: INTEGER, size: '11', required: false }
    unit_received: { phpName: UnitReceived, type: INTEGER, size: '11', required: false }
    total_pallets_for_asset: { phpName: TotalPalletsForAsset, type: DECIMAL, size: '32', scale: '0', required: false }
    total_cases_for_asset: { phpName: TotalCasesForAsset, type: DECIMAL, size: '41', scale: '0', required: false }
    total_units_for_asset: { phpName: TotalUnitsForAsset, type: DECIMAL, size: '41', scale: '0', required: false }

就我而言,这一切都很好。其他观点似乎宣布了一个神奇的Id领域,并且一直运作良好,进一步的研究告诉我这正是Propel所做的。它以前不是问题。

然而,现在突然间它引起了一个问题。我不明白为什么。任何人都可以帮我解决这个问题吗?那么为什么schema.yml中的这个特定定义没有ID呢?为什么我还需要突然拥有一个呢?

1 个答案:

答案 0 :(得分:1)

设置主键

未设置主键默认列为“id”