Skip to content

Commit

Permalink
[Path] fixes duplicate step slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorfin committed Sep 3, 2021
1 parent 95861ee commit 100e948
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugin/path/Entity/Step.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class Step
private $evaluated = false;

/**
* @Gedmo\Slug(fields={"title"}, unique=false)
* @Gedmo\Slug(fields={"title"}, unique=false, updatable=false)
* @ORM\Column(length=128)
*/
private $slug;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Innova\PathBundle\Installation\Migrations\pdo_mysql;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated migration based on mapping information: modify it with caution.
*
* Generation date: 2021/09/03 09:00:00
*/
class Version20210903090000 extends AbstractMigration
{
public function up(Schema $schema): void
{
$this->addSql('
UPDATE innova_step t1
INNER JOIN innova_step t2
SET t1.slug = CONCAT(t1.slug, "-", t1.id)
WHERE t1.id < t2.id
AND t1.slug = t2.slug
AND t1.path_id = t2.path_id
');
}

public function down(Schema $schema): void
{
}
}

0 comments on commit 100e948

Please sign in to comment.