开发者

Symfony and Doctrine: sluggable behaviour: field called "slug" is not created

I have this model:

Usuario:
   actAs:
     Sluggable:
       unique: true
       fields:  [nombre_apellidos]
       canUpdate: true
   inheritance:
     extends: sfGuardUser
     type: simple
   columns:
     username:
       type: string(128)
       notnull: false
       unique: true
     nombre_apellidos: string(60)
     sexo: boolean
     fecha_nac: date
     provincia: string(60)
     localidad: string(255开发者_开发百科)
     #email_address: string(255)
     fotografia: string(255)
     avatar: string(255)
   relations:
     Usuario:
       local: user1_id
       foreign: user2_id
       refClass: AmigoUsuario
       equal: true

I expected the field called 'slug' was created after "build doctrine:build --all", but no.

Why is a field called "slug" is not created?

Symfony 1.3


I met same problem and fixed by setting unique to false. If the unique is not very important to you, it will resolve your problem.


Try this:

Usuario:
   actAs:
     Sluggable:
       unique: true
       name: slug
       fields:  [nombre_apellidos]
       canUpdate: true

name should be by default 'slug', guess this won't help.


If Usario.class.php contains a getSlug() method, then just remove it from there, and all will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜