I have an entity which have a slug
field defined and managed using Gedmo Slug library.
Is it possible to easily define a list of unwanted values for this field (e.G. 'edit'
, 'new'
, 'delete'
...) or do I need to make something all by myself?
You could use a SlugHandler I guess.
Take a look at this : http://atlantic18.github.io/DoctrineExtensions/doc/sluggable.html#slug-handlers
You could create your own SlugHandler
, add some SlugHandlerOption
with your forbidden words, and use a simple regex to check if the generated slug is valid.
If not, you could modify the generated slug or throw an exception.