migrations/Version20240125062603.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20240125062603 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         $cms_pages $this->connection->fetchAssociative(
  18.             'SELECT id FROM cms_pages WHERE slug = :slug',
  19.             ['slug' => 'login']
  20.         );
  21.         $entries 
  22.             ['cms_id_id' => $cms_pages['id'],
  23.              'section_name' => 'Section 4''section_slug' => 'section_4'
  24.              'backend_template' => 'section_4''frontend_template' => 'section_4',
  25.              'position' => '4','deleted_at'=>null];
  26.        
  27.             $existingEntry $this->connection->fetchAssociative(
  28.                 'SELECT * FROM cms_sections WHERE cms_id_id = :cms_id_id AND section_name = :section_name',
  29.                 ['cms_id_id' => $cms_pages['id'], 'section_name' => $entries['section_name']]
  30.             );
  31.             if (!$existingEntry) {
  32.                 $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)', [
  33.                     'cms_id_id' => $entries['cms_id_id'],
  34.                     'section_name' => $entries['section_name'],
  35.                     'section_slug' => $entries['section_slug'],
  36.                     'backend_template' => $entries['backend_template'],
  37.                     'frontend_template' => $entries['frontend_template'],
  38.                     'position' => $entries['position'],
  39.                     'deleted_at' => $entries['deleted_at'],
  40.                 ]);
  41.         }
  42.         
  43.     }
  44.     public function down(Schema $schema): void
  45.     {
  46.         // this down() migration is auto-generated, please modify it to your needs
  47.     }
  48. }