migrations/Version20230227080202.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Connection;
  5. use Doctrine\DBAL\Result;
  6. use Doctrine\DBAL\Schema\Schema;
  7. use Doctrine\Migrations\AbstractMigration;
  8. use Psr\Log\LoggerInterface;
  9. /**
  10.  * Auto-generated Migration: Please modify to your needs!
  11.  */
  12. final class Version20230227080202 extends AbstractMigration
  13. {
  14.     public function getDescription(): string
  15.     {
  16.         return '';
  17.     }
  18.     public function up(Schema $schema): void
  19.     {
  20.         $this->addTourTypeLabel(1'ege-kultur-turu',"https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg");
  21.         $this->addTourTypeLabel(1'kibris-kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
  22.         $this->addTourTypeLabel(1'karadeniz-kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
  23.         $this->addTourTypeLabel(1'harikalar-diyari-balide-deniz-ubudda-kultur-turu','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
  24.         $this->addTourTypeLabel(1'kibris-kultur-turu-eylul-ekim-boyunca','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
  25.         $this->addTourTypeLabel(1'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  26.         $this->addTourTypeLabel(1'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
  27.         $this->addTourTypeLabel(1'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
  28.         $this->addTourTypeLabel(2'gulet-cruise-marmaris','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  29.         $this->addTourTypeLabel(2'otantik-gemi-hotel','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
  30.         $this->addTourTypeLabel(2'nuhun-gemisi-deluxe-hotel-spa','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
  31.         $this->addTourTypeLabel(2'batik-gemi-muzesi','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
  32.         $this->addTourTypeLabel(2'patmos-ada-gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
  33.         $this->addTourTypeLabel(2'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  34.         $this->addTourTypeLabel(2'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
  35.         $this->addTourTypeLabel(2'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  36.         $this->addTourTypeLabel(3'paris-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  37.         $this->addTourTypeLabel(3'barselona-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
  38.         $this->addTourTypeLabel(3'bali-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
  39.         $this->addTourTypeLabel(3'lyon-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
  40.         $this->addTourTypeLabel(3'viyana-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
  41.         $this->addTourTypeLabel(3'moskova-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  42.         $this->addTourTypeLabel(3'dubrovnik-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
  43.         $this->addTourTypeLabel(3'yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
  44.     }
  45.     private function addTourTypeLabel($tourTypeId$slug$imagePath)
  46.     {
  47.         /**
  48.          * @var $seoPage Result
  49.          */
  50.         $seoPage $this->connection->executeQuery('select id from seo_page where slug=?', [$slug], [\PDO::PARAM_STR]);
  51.         $count $seoPage->rowCount();
  52.         $seoPageId $seoPage->fetchOne();
  53.         if ($count 0) {
  54.             $this->connection->executeUpdate('INSERT INTO `tour_type_label` (`id`, `tour_type_id`, `seo_page_id`) VALUES (null, ' $tourTypeId ', ' $seoPageId ');');
  55.             $lastId $this->connection->fetchOne('SELECT LAST_INSERT_ID()');
  56.             if ($lastId) {
  57.                 $this->addSql("INSERT INTO `image` (`id`, `hotel_id`, `tour_id`, `hotel_event_id`, `type`, `full_path`, `width`, `height`, `mime`, `row`, `title`, `description`, `bucket`, `path`, `size`, `hotel_hotel_room_id`, `hotel_destination_id`, `landmark_id`, `oldtd_reference`, `tour_destination_id`, `marketing_campaign_id`, `aspect_ratio`, `tour_type_label_id`) VALUES
  58.     (null, NULL, NULL, NULL, 'TOUR_TYPE_LABEL', '" $imagePath "', 756, 425, 'image/webp', 0, 'test', 'test', 'tatildukkani_images', 'TOUR_TYPE_LABEL/4/1677498140.webp', 68.22, NULL, NULL, NULL, NULL, NULL, NULL, '16/9', " $lastId ");");
  59.             }
  60.         }
  61.     }
  62.     public function down(Schema $schema): void
  63.     {
  64.         // this down() migration is auto-generated, please modify it to your needs
  65.     }
  66. }