Symfony/Doctrine foreingkey at uniqueBy fileds, in sluggable behavior
I have the schema:
State:
actAs:
I18n:
fields: [state]
actAs:
Sluggable:
unique: true
uniqueBy: [lang, state]
fields: [state]
canUpdate: true
columns:
id:
type: integer(4)
primary: true
autoincrement: true
country_id:
type: string(2)
state:
type: string(2开发者_运维百科55)
notnull: true
And I want a unique slug by lang/state, whith this schema works fine, but, now I want a unique slug by lang/state/country_id. So, I add country_id to uniqueBy fields, but that don't work because the sluggable model is on translation table and country_id not.
Is there any idea how can i solved that?
Thanks a lot!
What about declaring your own slug builder?
State:
actAs:
I18n:
fields: [state]
actAs:
Sluggable:
unique: true
uniqueBy: [lang, state]
fields: [state]
builder: [MyTools, slugify]
canUpdate: true
精彩评论