我正在使用 DoctrineExtensions 并遵循文档。我的 Entity 字段装饰有 Sluggable 注释:
use Gedmo\Mapping\Annotation as Gedmo;
.
.
.
/**
* @Gedmo\Slug(fields={"city"}, updatable=false)
* @ORM\Column(length=255)
*/
private $slug;
当我尝试持久化一个新实体时,我收到一个 SQL 错误:
坚持:
$em = $this->getDoctrine()->getManager();
$em->persist($location);
$em->flush();
错误:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'slug' cannot be null
配置.yml:
# Stof Doctrine Extensions
stof_doctrine_extensions:
orm:
default:
sluggable: true
根据文档,这就是我所需要的,但没有生成蛞蝓。