<?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 Version20240125062603 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$cms_pages = $this->connection->fetchAssociative(
'SELECT id FROM cms_pages WHERE slug = :slug',
['slug' => 'login']
);
$entries =
['cms_id_id' => $cms_pages['id'],
'section_name' => 'Section 4', 'section_slug' => 'section_4',
'backend_template' => 'section_4', 'frontend_template' => 'section_4',
'position' => '4','deleted_at'=>null];
$existingEntry = $this->connection->fetchAssociative(
'SELECT * FROM cms_sections WHERE cms_id_id = :cms_id_id AND section_name = :section_name',
['cms_id_id' => $cms_pages['id'], 'section_name' => $entries['section_name']]
);
if (!$existingEntry) {
$this->addSql('INSERT INTO cms_sections (cms_id_id, section_name,section_slug,backend_template,frontend_template,position,deleted_at) VALUES (:cms_id_id, :section_name, :section_slug, :backend_template,:frontend_template,:position,deleted_at)', [
'cms_id_id' => $entries['cms_id_id'],
'section_name' => $entries['section_name'],
'section_slug' => $entries['section_slug'],
'backend_template' => $entries['backend_template'],
'frontend_template' => $entries['frontend_template'],
'position' => $entries['position'],
'deleted_at' => $entries['deleted_at'],
]);
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}