<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250924152449 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$rows = $this->connection->fetchAllAssociative('SELECT id, body FROM customer_interview_note WHERE body LIKE \'%<span class="text-editor-merge-field is-reference%\'');
foreach ($rows as $row) {
$updatedBody = preg_replace(
'#<span class="text-editor-merge-field-container"><span class="text-editor-merge-field is-reference" data-href="([^"]+)" contenteditable="false">(\#{0,1}\s*\d+)</span></span>#',
'<a href="$1">$2</a>',
$row['body']
);
if ($updatedBody !== $row['body']) {
$this->addSql('UPDATE customer_interview_note SET body = ? WHERE id = ?', [$updatedBody, $row['id']]);
}
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
// this migration is not reversible.
// the <a href> links will be kept as links and not reverted to <span>.
}
}