Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can generate the slug field the from existing data in database - Doctrine Symfony2

This is my entity, and i used a gedmo annotation, when a new register is created (persits) the slug works correctly but how can i auto-generate slug texts from existing database

 /**
 * @Gedmo\Slug(fields={"name"})
 * @ORM\Column(type="string", unique=true)
 */
protected $slug;
like image 625
Edgar Alfonso Avatar asked Mar 14 '23 11:03

Edgar Alfonso


1 Answers

You have to do it manually by selecting all the value without a slug and setting the slug value to null as describe inside the documentation of the Sluggable Behavior.

https://github.com/Atlantic18/DoctrineExtensions/blob/master/doc/sluggable.md#regenerating-slug

like image 129
Benoît Avatar answered Apr 25 '23 17:04

Benoît