<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Result;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
use Psr\Log\LoggerInterface;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20230227080202 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addTourTypeLabel(1, 'ege-kultur-turu',"https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg");
$this->addTourTypeLabel(1, 'kibris-kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
$this->addTourTypeLabel(1, 'karadeniz-kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
$this->addTourTypeLabel(1, 'harikalar-diyari-balide-deniz-ubudda-kultur-turu','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
$this->addTourTypeLabel(1, 'kibris-kultur-turu-eylul-ekim-boyunca','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
$this->addTourTypeLabel(1, 'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(1, 'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
$this->addTourTypeLabel(1, 'kultur-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
$this->addTourTypeLabel(2, 'gulet-cruise-marmaris','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(2, 'otantik-gemi-hotel','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
$this->addTourTypeLabel(2, 'nuhun-gemisi-deluxe-hotel-spa','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
$this->addTourTypeLabel(2, 'batik-gemi-muzesi','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
$this->addTourTypeLabel(2, 'patmos-ada-gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
$this->addTourTypeLabel(2, 'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(2, 'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
$this->addTourTypeLabel(2, 'gemi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(3, 'paris-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(3, 'barselona-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1580290365.jpg');
$this->addTourTypeLabel(3, 'bali-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
$this->addTourTypeLabel(3, 'lyon-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987934.jpg');
$this->addTourTypeLabel(3, 'viyana-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-tunus-1653987854.jpg');
$this->addTourTypeLabel(3, 'moskova-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
$this->addTourTypeLabel(3, 'dubrovnik-yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-havana-1653310654.jpg');
$this->addTourTypeLabel(3, 'yurtdisi-turlari','https://www.tatildukkani.com/assets/tour_destinations/l/pic-kazablanka-1475566295.jpg');
}
private function addTourTypeLabel($tourTypeId, $slug, $imagePath)
{
/**
* @var $seoPage Result
*/
$seoPage = $this->connection->executeQuery('select id from seo_page where slug=?', [$slug], [\PDO::PARAM_STR]);
$count = $seoPage->rowCount();
$seoPageId = $seoPage->fetchOne();
if ($count > 0) {
$this->connection->executeUpdate('INSERT INTO `tour_type_label` (`id`, `tour_type_id`, `seo_page_id`) VALUES (null, ' . $tourTypeId . ', ' . $seoPageId . ');');
$lastId = $this->connection->fetchOne('SELECT LAST_INSERT_ID()');
if ($lastId) {
$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
(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 . ");");
}
}
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
}
}