I use Symfony 3 framework and the sluggable doctrine extension. I need generate a slug with code like this:
<?php
/**
* @Gedmo\Mapping\Annotation\Slug(handlers={
* @Gedmo\Mapping\Annotation\SlugHandler(class="Gedmo\Sluggable\Handler\TreeSlugHandler", options={
* @Gedmo\Mapping\Annotation\SlugHandlerOption(name="parentRelationField", value="parent"),
* @Gedmo\Mapping\Annotation\SlugHandlerOption(name="separator", value="/")
* })
* }, fields={"title", "code"})
* @Doctrine\ORM\Mapping\Column(length=64, unique=true)
*/
private $slug;
I use TreeSlugHandler, but I want to use this handler, only if a slug is not set (if it's empty), because the handler rewrite the slug. How could I achieve that?