-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Open
Description
Feature Request
Some entities could have no meaningful properties, but developer can provide a getter method return string to build slug above.
How to use
Just put in fields option method 's name as any doctrine field name, SlugListener will call entity customGetter method.
#[Gedmo\Slug(fields: ['customGetter'])]
private ?string $slug = null;
public function customGetter(): string
{
return 'some string';
}
Do you think it could be an improvement on how we can build nicer slugs from our entities ?
I think I can work around by introducing a createdAt
field and then go with CustomSlugHandler but I don't really like introducing extra data in my URL that has little meaning for my users.
Another approach could be to allow fields option to be empty in Slug attribute if a SlugHandler attribute exists on the same property.
#[Gedmo\Slug] // no fields defined here
#[Gedmo\SlugHandler(class: MyCustomHandler::class)]
private ?string $slug = null;
Metadata
Metadata
Assignees
Labels
No labels