鼻涕虫排成交响乐


Slugs in symfony

我在symfony中遇到了一个问题。我用last_name和first_name字段定义了分段字段,但是当我加载fixture时,每个fixture的分段是基于表的title字段创建的,而不是基于我定义的字段。你知道为什么会这样吗?

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

确保您的定义看起来像:

# 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 }

所以以正确的方式设置字段:
{fields: [first_name,last_name],}

也许你检查你是否需要"uniqueBy"或多列slugs的自定义行为