I have tried to configure Gedmo Sluggable properly in a Symfony 4 application and failed. The issue is: it is not working. Any sluggable columns aren't recognized as being sluggable and stay empty after persisting.
composer.json:
"gedmo/doctrine-extensions": "^2.4",
services.yml:
services:
gedmo.listener.sluggable:
class: Gedmo\Sluggable\SluggableListener
tags:
- { name: doctrine.event_subscriber, connection: default, priority: 1 }
calls:
- [ setAnnotationReader, [ '@annotation_reader' ] ]
Entity Faculty.orm.yml
:
AppBundle\Entity\Faculty:
type: entity
table: faculty
repositoryClass: AppBundle\Repository\FacultyRepository
id:
id:
type: bigint
generator:
strategy: AUTO
fields:
name:
type: string
column: name
nullable: false
length: 128
slug:
type: string
length: 128
gedmo:
slug:
separator: _
style: camel
updatable: false
fields:
- name
uniqueConstraints:
idx_name:
columns: [ name ]
idx_slug:
columns: [ slug ]
However, when i persist an entity, the slug stays empty:
$faculty = new Faculty();
$faculty->setName('foobar');
$this->entityManager->persist($faculty);
$this->entityManager->flush();
Did i missed something?
I also tried out the StofDoctrineExtensionsBundle following this article. Without any luck. The Sluggable-Listener gets not triggered.