2011-11-23 48 views
0

我在symfony中遇到了slu problem的问题。我使用last_name和first_name字段定义了slug字段,但是当我加载fixtures时,每个fixture的slug都是基于表格的标题字段创建的,而不是基于我定义的字段。你知道为什么会发生这种情况吗?symfony中的S 012

Faculty: 
    tableName: faculty 
    inheritance: 
    extends: SvaGeneric 
    type: concrete 
    columns: 
    instructor_id: { type: string(20) } 
    first_name: { type: string(255), notnull: true } 
    last_name: { type: string(255), notnull: true } 
    title: { type: string(80) } 
    actAs: 
    Sluggable: 
     unique: true 
     fields: [last_name,first_name] 
     canUpdate: true 
+2

向我们展示该表的架构。 – Maerlyn

+0

请复制并粘贴您定义此处的schema.yml部分。 – dlondero

+0

Symfony的哪个版本? – greg0ire

回答

0

确保您的定义是这样的:

# config/doctrine/schema.yml 
JobeetCategory: 
    actAs: 
    Timestampable: ~ 
    Sluggable: 
     fields: [name] 
    columns: 
    first_name: 
     type: string(255) 
     notnull: true 
    last_name: {type: string(255), notnull:true } 

所以设置字段的正确方法:
Sluggable:{字段:名字,姓氏]}

也许你检查如果您需要“uniqueBy”或多列slu custom的自定义行为。