Skip to content

Commit 68b0afe

Browse files
author
Eric COURTIAL
committed
Post slug is no longer overridden
1 parent 681a45d commit 68b0afe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Form/PostType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
7979
->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) {
8080
/** @var Post */
8181
$post = $event->getData();
82-
if (null !== $postTitle = $post->getTitle()) {
83-
$post->setSlug($this->slugger->slug($postTitle)->lower());
82+
if (null === $post->getSlug() && null !== $post->getTitle()) {
83+
$post->setSlug($this->slugger->slug($post->getTitle())->lower());
8484
}
8585
})
8686
;

0 commit comments

Comments
 (0)