From 8e3499581a7d82cd2dc953517ba50eed3e217d18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Sun, 8 Oct 2023 12:37:44 +0200 Subject: [PATCH] WIP: WIP --- migrations/Version20230912134406.php | 37 -------- migrations/Version20230912134737.php | 37 -------- migrations/Version20230912140412.php | 31 ------- migrations/Version20230912142633.php | 33 ------- migrations/Version20230930150355.php | 49 ----------- migrations/Version20230930150821.php | 31 ------- migrations/Version20231002134820.php | 35 -------- migrations/Version20231004073716.php | 31 ------- migrations/Version20231004074116.php | 31 ------- migrations/Version20231004074136.php | 31 ------- migrations/Version20231004134943.php | 35 -------- migrations/Version20231005094552.php | 31 ------- migrations/Version20231005100242.php | 39 -------- migrations/Version20231005101119.php | 31 ------- migrations/Version20231006134112.php | 39 -------- migrations/Version20231006144941.php | 39 -------- migrations/Version20231006145056.php | 33 ------- migrations/Version20231006152954.php | 31 ------- migrations/Version20231006153242.php | 31 ------- migrations/Version20231006155227.php | 31 ------- migrations/Version20231007143035.php | 35 -------- migrations/Version20231007144753.php | 31 ------- migrations/Version20231007145904.php | 31 ------- migrations/Version20231007150056.php | 41 --------- migrations/Version20231007151506.php | 31 ------- ...14142908.php => Version20231008101243.php} | 64 +++++++------- src/Command/BpnImportCommand.php | 88 ++++++++++--------- .../Admin/Autocomplete/BpnDateController.php | 4 +- src/Entity/Assignment.php | 17 +++- src/Entity/{BpnDate.php => Destination.php} | 31 ++----- src/Entity/DispositionRequirement.php | 66 -------------- src/Form/AssignmentType.php | 8 +- src/Form/TeamerProfileType.php | 3 +- ...pository.php => DestinationRepository.php} | 26 +++--- .../DispositionRequirementRepository.php | 66 -------------- 35 files changed, 119 insertions(+), 1109 deletions(-) delete mode 100644 migrations/Version20230912134406.php delete mode 100644 migrations/Version20230912134737.php delete mode 100644 migrations/Version20230912140412.php delete mode 100644 migrations/Version20230912142633.php delete mode 100644 migrations/Version20230930150355.php delete mode 100644 migrations/Version20230930150821.php delete mode 100644 migrations/Version20231002134820.php delete mode 100644 migrations/Version20231004073716.php delete mode 100644 migrations/Version20231004074116.php delete mode 100644 migrations/Version20231004074136.php delete mode 100644 migrations/Version20231004134943.php delete mode 100644 migrations/Version20231005094552.php delete mode 100644 migrations/Version20231005100242.php delete mode 100644 migrations/Version20231005101119.php delete mode 100644 migrations/Version20231006134112.php delete mode 100644 migrations/Version20231006144941.php delete mode 100644 migrations/Version20231006145056.php delete mode 100644 migrations/Version20231006152954.php delete mode 100644 migrations/Version20231006153242.php delete mode 100644 migrations/Version20231006155227.php delete mode 100644 migrations/Version20231007143035.php delete mode 100644 migrations/Version20231007144753.php delete mode 100644 migrations/Version20231007145904.php delete mode 100644 migrations/Version20231007150056.php delete mode 100644 migrations/Version20231007151506.php rename migrations/{Version20230914142908.php => Version20231008101243.php} (62%) rename src/Entity/{BpnDate.php => Destination.php} (88%) delete mode 100644 src/Entity/DispositionRequirement.php rename src/Repository/{BpnDateRepository.php => DestinationRepository.php} (55%) delete mode 100644 src/Repository/DispositionRequirementRepository.php diff --git a/migrations/Version20230912134406.php b/migrations/Version20230912134406.php deleted file mode 100644 index 0c93459..0000000 --- a/migrations/Version20230912134406.php +++ /dev/null @@ -1,37 +0,0 @@ -addSql('CREATE TABLE teamer (id INT AUTO_INCREMENT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, gender VARCHAR(1) NOT NULL, date_of_birth DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', academic_title VARCHAR(255) DEFAULT NULL, salutation VARCHAR(255) DEFAULT NULL, nationality VARCHAR(255) DEFAULT NULL, tax_id VARCHAR(255) DEFAULT NULL, health_insurance_company VARCHAR(255) DEFAULT NULL, status VARCHAR(32) NOT NULL, remarks LONGTEXT DEFAULT NULL, address_street VARCHAR(255) DEFAULT NULL, address_post_code VARCHAR(255) DEFAULT NULL, address_city VARCHAR(255) DEFAULT NULL, address_country VARCHAR(255) DEFAULT NULL, communication_phone VARCHAR(255) DEFAULT NULL, communication_mobile VARCHAR(255) DEFAULT NULL, communication_email VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, teamer_id INT DEFAULT NULL, bus_pro_address_id INT NOT NULL, bus_pro_person_id INT NOT NULL, email VARCHAR(255) NOT NULL, roles LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', last_login_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D6494302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6494302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6494302FF75'); - $this->addSql('DROP TABLE teamer'); - $this->addSql('DROP TABLE user'); - $this->addSql('DROP TABLE messenger_messages'); - } -} diff --git a/migrations/Version20230912134737.php b/migrations/Version20230912134737.php deleted file mode 100644 index 62dc629..0000000 --- a/migrations/Version20230912134737.php +++ /dev/null @@ -1,37 +0,0 @@ -addSql('ALTER TABLE teamer ADD uuid VARCHAR(36) NOT NULL'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_15B751AED17F50A6 ON teamer (uuid)'); - $this->addSql('ALTER TABLE user ADD uuid VARCHAR(36) NOT NULL'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_8D93D649D17F50A6 ON user (uuid)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('DROP INDEX UNIQ_8D93D649D17F50A6 ON user'); - $this->addSql('ALTER TABLE user DROP uuid'); - $this->addSql('DROP INDEX UNIQ_15B751AED17F50A6 ON teamer'); - $this->addSql('ALTER TABLE teamer DROP uuid'); - } -} diff --git a/migrations/Version20230912140412.php b/migrations/Version20230912140412.php deleted file mode 100644 index 79f7bc0..0000000 --- a/migrations/Version20230912140412.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE teamer ADD bank_account_iban VARCHAR(255) DEFAULT NULL, ADD bank_account_bic VARCHAR(255) DEFAULT NULL, ADD bank_account_bank VARCHAR(255) DEFAULT NULL, ADD bank_account_holder VARCHAR(255) DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer DROP bank_account_iban, DROP bank_account_bic, DROP bank_account_bank, DROP bank_account_holder'); - } -} diff --git a/migrations/Version20230912142633.php b/migrations/Version20230912142633.php deleted file mode 100644 index fea2ac9..0000000 --- a/migrations/Version20230912142633.php +++ /dev/null @@ -1,33 +0,0 @@ -addSql('ALTER TABLE teamer ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\''); - $this->addSql('ALTER TABLE user ADD created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', ADD updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\''); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE user DROP created_at, DROP updated_at'); - $this->addSql('ALTER TABLE teamer DROP created_at, DROP updated_at'); - } -} diff --git a/migrations/Version20230930150355.php b/migrations/Version20230930150355.php deleted file mode 100644 index 10a0ccb..0000000 --- a/migrations/Version20230930150355.php +++ /dev/null @@ -1,49 +0,0 @@ -addSql('ALTER TABLE disposition_requirement DROP FOREIGN KEY FK_F3C6374CC26E160B'); - $this->addSql('ALTER TABLE assignment_pickup DROP FOREIGN KEY FK_79BF19E0C26E160B'); - $this->addSql('ALTER TABLE assignment_pickup DROP FOREIGN KEY FK_79BF19E0D19302F8'); - $this->addSql('DROP TABLE pickup'); - $this->addSql('DROP TABLE assignment_pickup'); - $this->addSql('DROP INDEX IDX_F3C6374CC26E160B ON disposition_requirement'); - $this->addSql('ALTER TABLE disposition_requirement DROP pickup_id'); - $this->addSql('ALTER TABLE job_profile CHANGE required_licenses required_licenses JSON NOT NULL COMMENT \'(DC2Type:json)\''); - $this->addSql('ALTER TABLE teamer ADD pickups JSON NOT NULL COMMENT \'(DC2Type:json)\''); - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\''); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE pickup (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, bus_pro_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); - $this->addSql('CREATE TABLE assignment_pickup (assignment_id INT NOT NULL, pickup_id INT NOT NULL, INDEX IDX_79BF19E0D19302F8 (assignment_id), INDEX IDX_79BF19E0C26E160B (pickup_id), PRIMARY KEY(assignment_id, pickup_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); - $this->addSql('ALTER TABLE assignment_pickup ADD CONSTRAINT FK_79BF19E0C26E160B FOREIGN KEY (pickup_id) REFERENCES pickup (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE assignment_pickup ADD CONSTRAINT FK_79BF19E0D19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE user CHANGE roles roles JSON NOT NULL COMMENT \'(DC2Type:json)\''); - $this->addSql('ALTER TABLE teamer DROP pickups'); - $this->addSql('ALTER TABLE disposition_requirement ADD pickup_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE disposition_requirement ADD CONSTRAINT FK_F3C6374CC26E160B FOREIGN KEY (pickup_id) REFERENCES pickup (id)'); - $this->addSql('CREATE INDEX IDX_F3C6374CC26E160B ON disposition_requirement (pickup_id)'); - $this->addSql('ALTER TABLE job_profile CHANGE required_licenses required_licenses JSON NOT NULL COMMENT \'(DC2Type:json)\''); - } -} diff --git a/migrations/Version20230930150821.php b/migrations/Version20230930150821.php deleted file mode 100644 index 0eeebb6..0000000 --- a/migrations/Version20230930150821.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE teamer ADD language VARCHAR(255) NOT NULL, ADD size VARCHAR(2) NOT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer DROP language, DROP size'); - } -} diff --git a/migrations/Version20231002134820.php b/migrations/Version20231002134820.php deleted file mode 100644 index 0086df2..0000000 --- a/migrations/Version20231002134820.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('CREATE TABLE teamer_availability (teamer_id INT NOT NULL, availability_id INT NOT NULL, INDEX IDX_9CF7958B4302FF75 (teamer_id), INDEX IDX_9CF7958B61778466 (availability_id), PRIMARY KEY(teamer_id, availability_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE teamer_availability ADD CONSTRAINT FK_9CF7958B4302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE teamer_availability ADD CONSTRAINT FK_9CF7958B61778466 FOREIGN KEY (availability_id) REFERENCES availability (id) ON DELETE CASCADE'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer_availability DROP FOREIGN KEY FK_9CF7958B4302FF75'); - $this->addSql('ALTER TABLE teamer_availability DROP FOREIGN KEY FK_9CF7958B61778466'); - $this->addSql('DROP TABLE teamer_availability'); - } -} diff --git a/migrations/Version20231004073716.php b/migrations/Version20231004073716.php deleted file mode 100644 index aee4477..0000000 --- a/migrations/Version20231004073716.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('DROP TABLE period'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE period (id INT AUTO_INCREMENT NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, updated_by VARCHAR(255) CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); - } -} diff --git a/migrations/Version20231004074116.php b/migrations/Version20231004074116.php deleted file mode 100644 index 2437c9b..0000000 --- a/migrations/Version20231004074116.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE teamer CHANGE language language VARCHAR(255) DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer CHANGE language language VARCHAR(255) NOT NULL'); - } -} diff --git a/migrations/Version20231004074136.php b/migrations/Version20231004074136.php deleted file mode 100644 index 27862df..0000000 --- a/migrations/Version20231004074136.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE teamer CHANGE size size VARCHAR(2) DEFAULT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer CHANGE size size VARCHAR(2) NOT NULL'); - } -} diff --git a/migrations/Version20231004134943.php b/migrations/Version20231004134943.php deleted file mode 100644 index 05463c0..0000000 --- a/migrations/Version20231004134943.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE assignment ADD job_profile_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BAA68D82A5 FOREIGN KEY (job_profile_id) REFERENCES job_profile (id)'); - $this->addSql('CREATE INDEX IDX_30C544BAA68D82A5 ON assignment (job_profile_id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BAA68D82A5'); - $this->addSql('DROP INDEX IDX_30C544BAA68D82A5 ON assignment'); - $this->addSql('ALTER TABLE assignment DROP job_profile_id'); - } -} diff --git a/migrations/Version20231005094552.php b/migrations/Version20231005094552.php deleted file mode 100644 index 9e9cc32..0000000 --- a/migrations/Version20231005094552.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE assignment ADD destination_bus_pro_id INT DEFAULT NULL, ADD pickup_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', ADD pickup INT DEFAULT NULL, DROP bus_pro_code, CHANGE available available INT DEFAULT NULL, CHANGE benefits benefits JSON NOT NULL COMMENT \'(DC2Type:json)\''); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment ADD bus_pro_code VARCHAR(64) NOT NULL, DROP destination_bus_pro_id, DROP pickup_date, DROP pickup, CHANGE available available INT NOT NULL, CHANGE benefits benefits LONGTEXT DEFAULT NULL'); - } -} diff --git a/migrations/Version20231005100242.php b/migrations/Version20231005100242.php deleted file mode 100644 index 5b30545..0000000 --- a/migrations/Version20231005100242.php +++ /dev/null @@ -1,39 +0,0 @@ -addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BA7E3C61F9'); - $this->addSql('DROP INDEX IDX_30C544BA7E3C61F9 ON assignment'); - $this->addSql('ALTER TABLE assignment CHANGE owner_id contact_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BAE7A1254A FOREIGN KEY (contact_id) REFERENCES user (id)'); - $this->addSql('CREATE INDEX IDX_30C544BAE7A1254A ON assignment (contact_id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BAE7A1254A'); - $this->addSql('DROP INDEX IDX_30C544BAE7A1254A ON assignment'); - $this->addSql('ALTER TABLE assignment CHANGE contact_id owner_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BA7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)'); - $this->addSql('CREATE INDEX IDX_30C544BA7E3C61F9 ON assignment (owner_id)'); - } -} diff --git a/migrations/Version20231005101119.php b/migrations/Version20231005101119.php deleted file mode 100644 index 06dd4bd..0000000 --- a/migrations/Version20231005101119.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE user ADD first_name VARCHAR(255) NOT NULL, ADD last_name VARCHAR(255) NOT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE user DROP first_name, DROP last_name'); - } -} diff --git a/migrations/Version20231006134112.php b/migrations/Version20231006134112.php deleted file mode 100644 index adbe235..0000000 --- a/migrations/Version20231006134112.php +++ /dev/null @@ -1,39 +0,0 @@ -addSql('CREATE TABLE bpn_date (id INT AUTO_INCREMENT NOT NULL, product_id INT NOT NULL, hotel_id INT NOT NULL, bus_pro_id INT NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', bus TINYINT(1) NOT NULL, INDEX IDX_18E376D24584665A (product_id), INDEX IDX_18E376D23243BB18 (hotel_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE bpn_hotel (id INT AUTO_INCREMENT NOT NULL, bus_pro_id INT NOT NULL, code VARCHAR(32) NOT NULL, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE bpn_product (id INT AUTO_INCREMENT NOT NULL, bus_pro_id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(32) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D24584665A FOREIGN KEY (product_id) REFERENCES bpn_date (id)'); - $this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D23243BB18 FOREIGN KEY (hotel_id) REFERENCES bpn_hotel (id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE bpn_date DROP FOREIGN KEY FK_18E376D24584665A'); - $this->addSql('ALTER TABLE bpn_date DROP FOREIGN KEY FK_18E376D23243BB18'); - $this->addSql('DROP TABLE bpn_date'); - $this->addSql('DROP TABLE bpn_hotel'); - $this->addSql('DROP TABLE bpn_product'); - } -} diff --git a/migrations/Version20231006144941.php b/migrations/Version20231006144941.php deleted file mode 100644 index 0d532e1..0000000 --- a/migrations/Version20231006144941.php +++ /dev/null @@ -1,39 +0,0 @@ -addSql('ALTER TABLE bpn_date DROP FOREIGN KEY FK_18E376D24584665A'); - $this->addSql('ALTER TABLE bpn_date DROP FOREIGN KEY FK_18E376D23243BB18'); - $this->addSql('DROP INDEX IDX_18E376D24584665A ON bpn_date'); - $this->addSql('DROP INDEX IDX_18E376D23243BB18 ON bpn_date'); - $this->addSql('ALTER TABLE bpn_date ADD code VARCHAR(32) NOT NULL, ADD product VARCHAR(255) NOT NULL, ADD hotel VARCHAR(255) NOT NULL, DROP product_id, DROP hotel_id'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE bpn_date ADD product_id INT NOT NULL, ADD hotel_id INT NOT NULL, DROP code, DROP product, DROP hotel'); - $this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D24584665A FOREIGN KEY (product_id) REFERENCES bpn_date (id)'); - $this->addSql('ALTER TABLE bpn_date ADD CONSTRAINT FK_18E376D23243BB18 FOREIGN KEY (hotel_id) REFERENCES bpn_hotel (id)'); - $this->addSql('CREATE INDEX IDX_18E376D24584665A ON bpn_date (product_id)'); - $this->addSql('CREATE INDEX IDX_18E376D23243BB18 ON bpn_date (hotel_id)'); - } -} diff --git a/migrations/Version20231006145056.php b/migrations/Version20231006145056.php deleted file mode 100644 index b42258b..0000000 --- a/migrations/Version20231006145056.php +++ /dev/null @@ -1,33 +0,0 @@ -addSql('DROP TABLE bpn_hotel'); - $this->addSql('DROP TABLE bpn_product'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('CREATE TABLE bpn_hotel (id INT AUTO_INCREMENT NOT NULL, bus_pro_id INT NOT NULL, code VARCHAR(32) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); - $this->addSql('CREATE TABLE bpn_product (id INT AUTO_INCREMENT NOT NULL, bus_pro_id INT NOT NULL, name VARCHAR(255) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, code VARCHAR(32) CHARACTER SET utf8mb4 NOT NULL COLLATE `utf8mb4_unicode_ci`, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB COMMENT = \'\' '); - } -} diff --git a/migrations/Version20231006152954.php b/migrations/Version20231006152954.php deleted file mode 100644 index 6eb2fe0..0000000 --- a/migrations/Version20231006152954.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE bpn_date ADD hotel_code VARCHAR(32) NOT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE bpn_date DROP hotel_code'); - } -} diff --git a/migrations/Version20231006153242.php b/migrations/Version20231006153242.php deleted file mode 100644 index e6e8fe4..0000000 --- a/migrations/Version20231006153242.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE bpn_date ADD pickups JSON NOT NULL COMMENT \'(DC2Type:json)\''); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE bpn_date DROP pickups'); - } -} diff --git a/migrations/Version20231006155227.php b/migrations/Version20231006155227.php deleted file mode 100644 index 5510dd1..0000000 --- a/migrations/Version20231006155227.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE bpn_date ADD hotel_bus_pro_id INT NOT NULL'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE bpn_date DROP hotel_bus_pro_id'); - } -} diff --git a/migrations/Version20231007143035.php b/migrations/Version20231007143035.php deleted file mode 100644 index 2b2ed46..0000000 --- a/migrations/Version20231007143035.php +++ /dev/null @@ -1,35 +0,0 @@ -addSql('ALTER TABLE assignment CHANGE date_from date_from DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', CHANGE date_to date_to DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', CHANGE destination_bus_pro_id destination_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BA816C6140 FOREIGN KEY (destination_id) REFERENCES bpn_date (id)'); - $this->addSql('CREATE INDEX IDX_30C544BA816C6140 ON assignment (destination_id)'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BA816C6140'); - $this->addSql('DROP INDEX IDX_30C544BA816C6140 ON assignment'); - $this->addSql('ALTER TABLE assignment CHANGE date_from date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', CHANGE date_to date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', CHANGE destination_id destination_bus_pro_id INT DEFAULT NULL'); - } -} diff --git a/migrations/Version20231007144753.php b/migrations/Version20231007144753.php deleted file mode 100644 index 13a643c..0000000 --- a/migrations/Version20231007144753.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE assignment ADD pickup_date_and_time DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP pickup_date'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment ADD pickup_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', DROP pickup_date_and_time'); - } -} diff --git a/migrations/Version20231007145904.php b/migrations/Version20231007145904.php deleted file mode 100644 index a8a3e88..0000000 --- a/migrations/Version20231007145904.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE assignment ADD pickup_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', DROP pickup_date_and_time'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment ADD pickup_date_and_time DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', DROP pickup_date'); - } -} diff --git a/migrations/Version20231007150056.php b/migrations/Version20231007150056.php deleted file mode 100644 index a0baa61..0000000 --- a/migrations/Version20231007150056.php +++ /dev/null @@ -1,41 +0,0 @@ -addSql('CREATE TABLE job_profile_training (job_profile_id INT NOT NULL, training_id INT NOT NULL, INDEX IDX_F19E0BB8A68D82A5 (job_profile_id), INDEX IDX_F19E0BB8BEFD98D1 (training_id), PRIMARY KEY(job_profile_id, training_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('ALTER TABLE job_profile_training ADD CONSTRAINT FK_F19E0BB8A68D82A5 FOREIGN KEY (job_profile_id) REFERENCES job_profile (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE job_profile_training ADD CONSTRAINT FK_F19E0BB8BEFD98D1 FOREIGN KEY (training_id) REFERENCES training (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE job_profile DROP FOREIGN KEY FK_1BB81D94FEBEF441'); - $this->addSql('DROP INDEX IDX_1BB81D94FEBEF441 ON job_profile'); - $this->addSql('ALTER TABLE job_profile DROP required_training_id'); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE job_profile_training DROP FOREIGN KEY FK_F19E0BB8A68D82A5'); - $this->addSql('ALTER TABLE job_profile_training DROP FOREIGN KEY FK_F19E0BB8BEFD98D1'); - $this->addSql('DROP TABLE job_profile_training'); - $this->addSql('ALTER TABLE job_profile ADD required_training_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE job_profile ADD CONSTRAINT FK_1BB81D94FEBEF441 FOREIGN KEY (required_training_id) REFERENCES training (id)'); - $this->addSql('CREATE INDEX IDX_1BB81D94FEBEF441 ON job_profile (required_training_id)'); - } -} diff --git a/migrations/Version20231007151506.php b/migrations/Version20231007151506.php deleted file mode 100644 index 44122a8..0000000 --- a/migrations/Version20231007151506.php +++ /dev/null @@ -1,31 +0,0 @@ -addSql('ALTER TABLE assignment CHANGE pickup_date pickup_date DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\''); - } - - public function down(Schema $schema): void - { - // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE assignment CHANGE pickup_date pickup_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\''); - } -} diff --git a/migrations/Version20230914142908.php b/migrations/Version20231008101243.php similarity index 62% rename from migrations/Version20230914142908.php rename to migrations/Version20231008101243.php index d982de0..36cef1f 100644 --- a/migrations/Version20230914142908.php +++ b/migrations/Version20231008101243.php @@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration; /** * Auto-generated Migration: Please modify to your needs! */ -final class Version20230914142908 extends AbstractMigration +final class Version20231008101243 extends AbstractMigration { public function getDescription(): string { @@ -21,41 +21,44 @@ final class Version20230914142908 extends AbstractMigration { // this up() migration is auto-generated, please modify it to your needs $this->addSql('CREATE TABLE application (id INT AUTO_INCREMENT NOT NULL, assignment_id INT DEFAULT NULL, teamer_id INT DEFAULT NULL, requests LONGTEXT DEFAULT NULL, status VARCHAR(64) NOT NULL, remarks LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_A45BDDC1D19302F8 (assignment_id), INDEX IDX_A45BDDC14302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE assignment (id INT AUTO_INCREMENT NOT NULL, owner_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, bus_pro_code VARCHAR(64) NOT NULL, available INT NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', benefits LONGTEXT DEFAULT NULL, remarks LONGTEXT DEFAULT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_30C544BAD17F50A6 (uuid), INDEX IDX_30C544BA7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE assignment_pickup (assignment_id INT NOT NULL, pickup_id INT NOT NULL, INDEX IDX_79BF19E0D19302F8 (assignment_id), INDEX IDX_79BF19E0C26E160B (pickup_id), PRIMARY KEY(assignment_id, pickup_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE assignment (id INT AUTO_INCREMENT NOT NULL, destination_id INT DEFAULT NULL, job_profile_id INT DEFAULT NULL, contact_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, available INT DEFAULT NULL, date_from DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', pickup_date DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', pickup INT DEFAULT NULL, benefits JSON NOT NULL COMMENT \'(DC2Type:json)\', remarks LONGTEXT DEFAULT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_30C544BAD17F50A6 (uuid), INDEX IDX_30C544BA816C6140 (destination_id), INDEX IDX_30C544BAA68D82A5 (job_profile_id), INDEX IDX_30C544BAE7A1254A (contact_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE assignment_fee (assignment_id INT NOT NULL, fee_id INT NOT NULL, INDEX IDX_4E2AE50AD19302F8 (assignment_id), INDEX IDX_4E2AE50AAB45AECA (fee_id), PRIMARY KEY(assignment_id, fee_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE availability (id INT AUTO_INCREMENT NOT NULL, owner_id INT DEFAULT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_3FB7A2BF7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE destination (id INT AUTO_INCREMENT NOT NULL, bus_pro_id INT NOT NULL, code VARCHAR(32) NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', product VARCHAR(255) NOT NULL, hotel VARCHAR(255) NOT NULL, hotel_code VARCHAR(32) NOT NULL, hotel_bus_pro_id INT NOT NULL, pickups JSON NOT NULL COMMENT \'(DC2Type:json)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE disposition (id INT AUTO_INCREMENT NOT NULL, assignment_id INT DEFAULT NULL, teamer_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, remarks LONGTEXT DEFAULT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_4C58BF60D17F50A6 (uuid), INDEX IDX_4C58BF60D19302F8 (assignment_id), INDEX IDX_4C58BF604302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE disposition_requirement (id INT AUTO_INCREMENT NOT NULL, training_id INT DEFAULT NULL, pickup_id INT DEFAULT NULL, assignment_id INT DEFAULT NULL, pickup_date DATE DEFAULT NULL COMMENT \'(DC2Type:date_immutable)\', INDEX IDX_F3C6374CBEFD98D1 (training_id), INDEX IDX_F3C6374CC26E160B (pickup_id), INDEX IDX_F3C6374CD19302F8 (assignment_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE faq (id INT AUTO_INCREMENT NOT NULL, question LONGTEXT NOT NULL, answer LONGTEXT NOT NULL, sorting INT NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE fee (id INT AUTO_INCREMENT NOT NULL, value INT NOT NULL, name VARCHAR(255) NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE feedback (id INT AUTO_INCREMENT NOT NULL, teamer_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, body LONGTEXT NOT NULL, assignment_destination VARCHAR(255) NOT NULL, assignment_date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', author_name VARCHAR(255) NOT NULL, author_email VARCHAR(255) NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_D2294458D17F50A6 (uuid), INDEX IDX_D22944584302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE job_profile (id INT AUTO_INCREMENT NOT NULL, required_training_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, required_licenses LONGTEXT NOT NULL COMMENT \'(DC2Type:json)\', created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_1BB81D94D17F50A6 (uuid), INDEX IDX_1BB81D94FEBEF441 (required_training_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE job_profile (id INT AUTO_INCREMENT NOT NULL, uuid VARCHAR(36) NOT NULL, name VARCHAR(255) NOT NULL, required_licenses JSON NOT NULL COMMENT \'(DC2Type:json)\', created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_1BB81D94D17F50A6 (uuid), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE job_profile_training (job_profile_id INT NOT NULL, training_id INT NOT NULL, INDEX IDX_F19E0BB8A68D82A5 (job_profile_id), INDEX IDX_F19E0BB8BEFD98D1 (training_id), PRIMARY KEY(job_profile_id, training_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE license (id INT AUTO_INCREMENT NOT NULL, certificate_id INT DEFAULT NULL, teamer_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, type VARCHAR(64) NOT NULL, date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_5768F419D17F50A6 (uuid), UNIQUE INDEX UNIQ_5768F41999223FFD (certificate_id), INDEX IDX_5768F4194302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE period (id INT AUTO_INCREMENT NOT NULL, date_from DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', date_to DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); - $this->addSql('CREATE TABLE pickup (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, bus_pro_id INT NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE teamer (id INT AUTO_INCREMENT NOT NULL, photo_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, gender VARCHAR(1) NOT NULL, date_of_birth DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', academic_title VARCHAR(255) DEFAULT NULL, salutation VARCHAR(255) DEFAULT NULL, nationality VARCHAR(255) DEFAULT NULL, tax_id VARCHAR(255) DEFAULT NULL, health_insurance_company VARCHAR(255) DEFAULT NULL, status VARCHAR(32) NOT NULL, remarks LONGTEXT DEFAULT NULL, pickups JSON NOT NULL COMMENT \'(DC2Type:json)\', language VARCHAR(255) DEFAULT NULL, size VARCHAR(2) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', address_street VARCHAR(255) DEFAULT NULL, address_post_code VARCHAR(255) DEFAULT NULL, address_city VARCHAR(255) DEFAULT NULL, address_country VARCHAR(255) DEFAULT NULL, communication_phone VARCHAR(255) DEFAULT NULL, communication_mobile VARCHAR(255) DEFAULT NULL, communication_email VARCHAR(255) DEFAULT NULL, bank_account_iban VARCHAR(255) DEFAULT NULL, bank_account_bic VARCHAR(255) DEFAULT NULL, bank_account_bank VARCHAR(255) DEFAULT NULL, bank_account_holder VARCHAR(255) DEFAULT NULL, UNIQUE INDEX UNIQ_15B751AED17F50A6 (uuid), UNIQUE INDEX UNIQ_15B751AE7E9E4C8C (photo_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE teamer_availability (teamer_id INT NOT NULL, availability_id INT NOT NULL, INDEX IDX_9CF7958B4302FF75 (teamer_id), INDEX IDX_9CF7958B61778466 (availability_id), PRIMARY KEY(teamer_id, availability_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE teamer_job_profile (teamer_id INT NOT NULL, job_profile_id INT NOT NULL, INDEX IDX_E78F5DF64302FF75 (teamer_id), INDEX IDX_E78F5DF6A68D82A5 (job_profile_id), PRIMARY KEY(teamer_id, job_profile_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE teamer_assignment (teamer_id INT NOT NULL, assignment_id INT NOT NULL, INDEX IDX_BE0D5AE14302FF75 (teamer_id), INDEX IDX_BE0D5AE1D19302F8 (assignment_id), PRIMARY KEY(teamer_id, assignment_id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE training (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE training_attendance (id INT AUTO_INCREMENT NOT NULL, training_id INT DEFAULT NULL, certificate_id INT DEFAULT NULL, teamer_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, date DATE NOT NULL COMMENT \'(DC2Type:date_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_D75DB7F7D17F50A6 (uuid), INDEX IDX_D75DB7F7BEFD98D1 (training_id), UNIQUE INDEX UNIQ_D75DB7F799223FFD (certificate_id), INDEX IDX_D75DB7F74302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('CREATE TABLE upload (id INT AUTO_INCREMENT NOT NULL, owner_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, type VARCHAR(64) NOT NULL, status VARCHAR(64) DEFAULT NULL, filename VARCHAR(255) NOT NULL, original_filename VARCHAR(255) NOT NULL, size INT NOT NULL, mime_type VARCHAR(255) NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_17BDE61FD17F50A6 (uuid), INDEX IDX_17BDE61F7E3C61F9 (owner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE user (id INT AUTO_INCREMENT NOT NULL, teamer_id INT DEFAULT NULL, uuid VARCHAR(36) NOT NULL, bus_pro_address_id INT NOT NULL, bus_pro_person_id INT NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, email VARCHAR(255) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', last_login_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', updated_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649D17F50A6 (uuid), UNIQUE INDEX UNIQ_8D93D6494302FF75 (teamer_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + $this->addSql('CREATE TABLE messenger_messages (id BIGINT AUTO_INCREMENT NOT NULL, body LONGTEXT NOT NULL, headers LONGTEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', available_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', delivered_at DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_75EA56E0FB7336F0 (queue_name), INDEX IDX_75EA56E0E3BD61CE (available_at), INDEX IDX_75EA56E016BA31DB (delivered_at), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); $this->addSql('ALTER TABLE application ADD CONSTRAINT FK_A45BDDC1D19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id)'); $this->addSql('ALTER TABLE application ADD CONSTRAINT FK_A45BDDC14302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); - $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BA7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE assignment_pickup ADD CONSTRAINT FK_79BF19E0D19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id) ON DELETE CASCADE'); - $this->addSql('ALTER TABLE assignment_pickup ADD CONSTRAINT FK_79BF19E0C26E160B FOREIGN KEY (pickup_id) REFERENCES pickup (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BA816C6140 FOREIGN KEY (destination_id) REFERENCES destination (id)'); + $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BAA68D82A5 FOREIGN KEY (job_profile_id) REFERENCES job_profile (id)'); + $this->addSql('ALTER TABLE assignment ADD CONSTRAINT FK_30C544BAE7A1254A FOREIGN KEY (contact_id) REFERENCES user (id)'); $this->addSql('ALTER TABLE assignment_fee ADD CONSTRAINT FK_4E2AE50AD19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE assignment_fee ADD CONSTRAINT FK_4E2AE50AAB45AECA FOREIGN KEY (fee_id) REFERENCES fee (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE availability ADD CONSTRAINT FK_3FB7A2BF7E3C61F9 FOREIGN KEY (owner_id) REFERENCES teamer (id)'); $this->addSql('ALTER TABLE disposition ADD CONSTRAINT FK_4C58BF60D19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id)'); $this->addSql('ALTER TABLE disposition ADD CONSTRAINT FK_4C58BF604302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); - $this->addSql('ALTER TABLE disposition_requirement ADD CONSTRAINT FK_F3C6374CBEFD98D1 FOREIGN KEY (training_id) REFERENCES training (id)'); - $this->addSql('ALTER TABLE disposition_requirement ADD CONSTRAINT FK_F3C6374CC26E160B FOREIGN KEY (pickup_id) REFERENCES pickup (id)'); - $this->addSql('ALTER TABLE disposition_requirement ADD CONSTRAINT FK_F3C6374CD19302F8 FOREIGN KEY (assignment_id) REFERENCES assignment (id)'); $this->addSql('ALTER TABLE feedback ADD CONSTRAINT FK_D22944584302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); - $this->addSql('ALTER TABLE job_profile ADD CONSTRAINT FK_1BB81D94FEBEF441 FOREIGN KEY (required_training_id) REFERENCES training (id)'); + $this->addSql('ALTER TABLE job_profile_training ADD CONSTRAINT FK_F19E0BB8A68D82A5 FOREIGN KEY (job_profile_id) REFERENCES job_profile (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE job_profile_training ADD CONSTRAINT FK_F19E0BB8BEFD98D1 FOREIGN KEY (training_id) REFERENCES training (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE license ADD CONSTRAINT FK_5768F41999223FFD FOREIGN KEY (certificate_id) REFERENCES upload (id)'); $this->addSql('ALTER TABLE license ADD CONSTRAINT FK_5768F4194302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); + $this->addSql('ALTER TABLE teamer ADD CONSTRAINT FK_15B751AE7E9E4C8C FOREIGN KEY (photo_id) REFERENCES upload (id)'); + $this->addSql('ALTER TABLE teamer_availability ADD CONSTRAINT FK_9CF7958B4302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id) ON DELETE CASCADE'); + $this->addSql('ALTER TABLE teamer_availability ADD CONSTRAINT FK_9CF7958B61778466 FOREIGN KEY (availability_id) REFERENCES availability (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE teamer_job_profile ADD CONSTRAINT FK_E78F5DF64302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE teamer_job_profile ADD CONSTRAINT FK_E78F5DF6A68D82A5 FOREIGN KEY (job_profile_id) REFERENCES job_profile (id) ON DELETE CASCADE'); $this->addSql('ALTER TABLE teamer_assignment ADD CONSTRAINT FK_BE0D5AE14302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id) ON DELETE CASCADE'); @@ -64,32 +67,30 @@ final class Version20230914142908 extends AbstractMigration $this->addSql('ALTER TABLE training_attendance ADD CONSTRAINT FK_D75DB7F799223FFD FOREIGN KEY (certificate_id) REFERENCES upload (id)'); $this->addSql('ALTER TABLE training_attendance ADD CONSTRAINT FK_D75DB7F74302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); $this->addSql('ALTER TABLE upload ADD CONSTRAINT FK_17BDE61F7E3C61F9 FOREIGN KEY (owner_id) REFERENCES user (id)'); - $this->addSql('ALTER TABLE teamer ADD photo_id INT DEFAULT NULL'); - $this->addSql('ALTER TABLE teamer ADD CONSTRAINT FK_15B751AE7E9E4C8C FOREIGN KEY (photo_id) REFERENCES upload (id)'); - $this->addSql('CREATE UNIQUE INDEX UNIQ_15B751AE7E9E4C8C ON teamer (photo_id)'); + $this->addSql('ALTER TABLE user ADD CONSTRAINT FK_8D93D6494302FF75 FOREIGN KEY (teamer_id) REFERENCES teamer (id)'); } public function down(Schema $schema): void { // this down() migration is auto-generated, please modify it to your needs - $this->addSql('ALTER TABLE teamer DROP FOREIGN KEY FK_15B751AE7E9E4C8C'); $this->addSql('ALTER TABLE application DROP FOREIGN KEY FK_A45BDDC1D19302F8'); $this->addSql('ALTER TABLE application DROP FOREIGN KEY FK_A45BDDC14302FF75'); - $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BA7E3C61F9'); - $this->addSql('ALTER TABLE assignment_pickup DROP FOREIGN KEY FK_79BF19E0D19302F8'); - $this->addSql('ALTER TABLE assignment_pickup DROP FOREIGN KEY FK_79BF19E0C26E160B'); + $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BA816C6140'); + $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BAA68D82A5'); + $this->addSql('ALTER TABLE assignment DROP FOREIGN KEY FK_30C544BAE7A1254A'); $this->addSql('ALTER TABLE assignment_fee DROP FOREIGN KEY FK_4E2AE50AD19302F8'); $this->addSql('ALTER TABLE assignment_fee DROP FOREIGN KEY FK_4E2AE50AAB45AECA'); $this->addSql('ALTER TABLE availability DROP FOREIGN KEY FK_3FB7A2BF7E3C61F9'); $this->addSql('ALTER TABLE disposition DROP FOREIGN KEY FK_4C58BF60D19302F8'); $this->addSql('ALTER TABLE disposition DROP FOREIGN KEY FK_4C58BF604302FF75'); - $this->addSql('ALTER TABLE disposition_requirement DROP FOREIGN KEY FK_F3C6374CBEFD98D1'); - $this->addSql('ALTER TABLE disposition_requirement DROP FOREIGN KEY FK_F3C6374CC26E160B'); - $this->addSql('ALTER TABLE disposition_requirement DROP FOREIGN KEY FK_F3C6374CD19302F8'); $this->addSql('ALTER TABLE feedback DROP FOREIGN KEY FK_D22944584302FF75'); - $this->addSql('ALTER TABLE job_profile DROP FOREIGN KEY FK_1BB81D94FEBEF441'); + $this->addSql('ALTER TABLE job_profile_training DROP FOREIGN KEY FK_F19E0BB8A68D82A5'); + $this->addSql('ALTER TABLE job_profile_training DROP FOREIGN KEY FK_F19E0BB8BEFD98D1'); $this->addSql('ALTER TABLE license DROP FOREIGN KEY FK_5768F41999223FFD'); $this->addSql('ALTER TABLE license DROP FOREIGN KEY FK_5768F4194302FF75'); + $this->addSql('ALTER TABLE teamer DROP FOREIGN KEY FK_15B751AE7E9E4C8C'); + $this->addSql('ALTER TABLE teamer_availability DROP FOREIGN KEY FK_9CF7958B4302FF75'); + $this->addSql('ALTER TABLE teamer_availability DROP FOREIGN KEY FK_9CF7958B61778466'); $this->addSql('ALTER TABLE teamer_job_profile DROP FOREIGN KEY FK_E78F5DF64302FF75'); $this->addSql('ALTER TABLE teamer_job_profile DROP FOREIGN KEY FK_E78F5DF6A68D82A5'); $this->addSql('ALTER TABLE teamer_assignment DROP FOREIGN KEY FK_BE0D5AE14302FF75'); @@ -98,26 +99,27 @@ final class Version20230914142908 extends AbstractMigration $this->addSql('ALTER TABLE training_attendance DROP FOREIGN KEY FK_D75DB7F799223FFD'); $this->addSql('ALTER TABLE training_attendance DROP FOREIGN KEY FK_D75DB7F74302FF75'); $this->addSql('ALTER TABLE upload DROP FOREIGN KEY FK_17BDE61F7E3C61F9'); + $this->addSql('ALTER TABLE user DROP FOREIGN KEY FK_8D93D6494302FF75'); $this->addSql('DROP TABLE application'); $this->addSql('DROP TABLE assignment'); - $this->addSql('DROP TABLE assignment_pickup'); $this->addSql('DROP TABLE assignment_fee'); $this->addSql('DROP TABLE availability'); + $this->addSql('DROP TABLE destination'); $this->addSql('DROP TABLE disposition'); - $this->addSql('DROP TABLE disposition_requirement'); $this->addSql('DROP TABLE faq'); $this->addSql('DROP TABLE fee'); $this->addSql('DROP TABLE feedback'); $this->addSql('DROP TABLE job_profile'); + $this->addSql('DROP TABLE job_profile_training'); $this->addSql('DROP TABLE license'); - $this->addSql('DROP TABLE period'); - $this->addSql('DROP TABLE pickup'); + $this->addSql('DROP TABLE teamer'); + $this->addSql('DROP TABLE teamer_availability'); $this->addSql('DROP TABLE teamer_job_profile'); $this->addSql('DROP TABLE teamer_assignment'); $this->addSql('DROP TABLE training'); $this->addSql('DROP TABLE training_attendance'); $this->addSql('DROP TABLE upload'); - $this->addSql('DROP INDEX UNIQ_15B751AE7E9E4C8C ON teamer'); - $this->addSql('ALTER TABLE teamer DROP photo_id'); + $this->addSql('DROP TABLE user'); + $this->addSql('DROP TABLE messenger_messages'); } } diff --git a/src/Command/BpnImportCommand.php b/src/Command/BpnImportCommand.php index 024bc2b..24f4f18 100644 --- a/src/Command/BpnImportCommand.php +++ b/src/Command/BpnImportCommand.php @@ -45,14 +45,9 @@ class BpnImportCommand extends Command return Command::FAILURE; } - // Flush dates - $this - ->connection - ->executeQuery('TRUNCATE TABLE bpn_date') - ; - $io->info('Found '.$totalCount.' XML files'); - $datesCount = 0; + $addedCount = 0; + $updatedCount = 0; // Iterate over xml files foreach ($xmlFiles as $xmlFile) { @@ -60,26 +55,17 @@ class BpnImportCommand extends Command // Load xml file into simplexml object $xml = simplexml_load_file($xmlFile); - // Iterate over all dates - foreach ($xml->xpath('reise/termin') as $dateXml) { - $product = (string) $dateXml->xpath('text')[0]; - $busProId = (int) $dateXml->attributes()['idbuspro']; - $code = (string) $dateXml->attributes()['code']; - $dateFrom = \DateTimeImmutable::createFromFormat('d.m.Y', (string) $dateXml->attributes()['termin']); - $dateTo = \DateTimeImmutable::createFromFormat('d.m.Y', (string) $dateXml->attributes()['bis']); - $bus = false; - - // Iterate over all service entries and look for 'bus' - foreach ($dateXml->xpath('lei_befoerderung/leistung') as $serviceXml) { - if ('BUS' === (string) $serviceXml->attributes()['unterart']) { - $bus = true; - break; - } - } + // Iterate over all destinations + foreach ($xml->xpath('reise/termin') as $destinationXml) { + $product = (string) $destinationXml->xpath('text')[0]; + $busProId = (int) $destinationXml->attributes()['idbuspro']; + $code = (string) $destinationXml->attributes()['code']; + $dateFrom = \DateTimeImmutable::createFromFormat('d.m.Y', (string) $destinationXml->attributes()['termin']); + $dateTo = \DateTimeImmutable::createFromFormat('d.m.Y', (string) $destinationXml->attributes()['bis']); // Find pickups $datePickups = []; - foreach ($dateXml->xpath('zustiege/zustieg') as $pickupXml) { + foreach ($destinationXml->xpath('zustiege/zustieg') as $pickupXml) { $pickupBusProId = (int) $pickupXml->attributes()['idbuspro']; if ($pickupBusProId) { $pickup = $this->pickupDataProvider->get($pickupBusProId); @@ -93,32 +79,48 @@ class BpnImportCommand extends Command } // Iterate over all hotel entries - foreach ($dateXml->xpath('hotel') as $hotelXml) { + foreach ($destinationXml->xpath('hotel') as $hotelXml) { $hotelBusProId = (int) $hotelXml->attributes()['idbuspro']; $hotel = $this->hotelDataProvider->get($hotelBusProId); - // Finally store collected data - $this - ->connection - ->insert('bpn_date', [ - 'code' => $code, - 'bus_pro_id' => $busProId, - 'date_from' => $dateFrom->format('Y-m-d'), - 'date_to' => $dateTo->format('Y-m-d'), - 'product' => $product, - 'hotel' => $hotel->getName(), - 'hotel_code' => $hotel->getCode(), - 'hotel_bus_pro_id' => $hotelBusProId, - 'bus' => (int) $bus, - 'pickups' => json_encode($datePickups), - ]) - ; - ++$datesCount; + // Finally update or store collected data + if ($id = $this->connection->fetchOne('SELECT id FROM destination WHERE bus_pro_id=? AND hotel_bus_pro_id=?', [$busProId, $hotelBusProId])) { + $this + ->connection + ->update('destination', [ + 'code' => $code, + 'date_from' => $dateFrom->format('Y-m-d'), + 'date_to' => $dateTo->format('Y-m-d'), + 'product' => $product, + 'pickups' => json_encode($datePickups), + ], [ + 'id' => $id, + 'hotel_bus_pro_id' => $hotelBusProId, + ]) + ; + ++$updatedCount; + } else { + $this + ->connection + ->insert('destination', [ + 'code' => $code, + 'bus_pro_id' => $busProId, + 'date_from' => $dateFrom->format('Y-m-d'), + 'date_to' => $dateTo->format('Y-m-d'), + 'product' => $product, + 'hotel' => $hotel->getName(), + 'hotel_code' => $hotel->getCode(), + 'hotel_bus_pro_id' => $hotelBusProId, + 'pickups' => json_encode($datePickups), + ]) + ; + ++$addedCount; + } } } } - $io->info('Imported '.$datesCount.' dates'); + $io->info('Added '.$addedCount.' and updated '.$updatedCount.' destinations'); return Command::SUCCESS; } diff --git a/src/Controller/Admin/Autocomplete/BpnDateController.php b/src/Controller/Admin/Autocomplete/BpnDateController.php index 1b37673..c9c4384 100644 --- a/src/Controller/Admin/Autocomplete/BpnDateController.php +++ b/src/Controller/Admin/Autocomplete/BpnDateController.php @@ -2,7 +2,7 @@ namespace App\Controller\Admin\Autocomplete; -use App\Repository\BpnDateRepository; +use App\Repository\DestinationRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; @@ -11,7 +11,7 @@ use Symfony\Component\Security\Http\Attribute\IsGranted; class BpnDateController extends AbstractController { - public function __construct(private readonly BpnDateRepository $bpnDateRepository) + public function __construct(private readonly DestinationRepository $bpnDateRepository) {} #[Route('/admin/autocomplete/bpndate', name: 'app_admin_autocomplete_bpndate')] diff --git a/src/Entity/Assignment.php b/src/Entity/Assignment.php index 5774728..731038d 100644 --- a/src/Entity/Assignment.php +++ b/src/Entity/Assignment.php @@ -6,13 +6,13 @@ use App\Entity\Traits\BlameableEntity; use App\Entity\Traits\TimestampableEntity; use App\Model\BenefitsDto; use App\Repository\AssignmentRepository; +use Carbon\CarbonPeriod; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Uid\Uuid; use Symfony\Component\Validator\Constraints as Assert; -use Symfony\Component\Validator\Context\ExecutionContextInterface; #[ORM\Entity(repositoryClass: AssignmentRepository::class)] class Assignment implements BlameableEntityInterface, TimestampableEntityInterface @@ -30,7 +30,7 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa #[ORM\ManyToOne] #[Assert\NotNull(message: 'Bitte gib die Destination an')] - private ?BpnDate $destination = null; + private ?Destination $destination = null; #[ORM\ManyToOne] #[Assert\NotNull(message: 'Bitte gib das Jobprofil an')] @@ -91,12 +91,12 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa return $this->uuid; } - public function getDestination(): ?BpnDate + public function getDestination(): ?Destination { return $this->destination; } - public function setDestination(?BpnDate $destination): static + public function setDestination(?Destination $destination): static { $this->destination = $destination; @@ -151,6 +151,15 @@ class Assignment implements BlameableEntityInterface, TimestampableEntityInterfa return $this; } + public function getTotalPeriod(): CarbonPeriod + { + $destination = $this->getDestination(); + $dateFrom = $this->getDateFrom() ?? $destination->getDateFrom(); + $dateTo = $this->getDateTo() ?? $destination->getDateTo(); + + return new CarbonPeriod($dateFrom, $dateTo); + } + public function getPickupDate(): ?\DateTimeImmutable { return $this->pickupDate; diff --git a/src/Entity/BpnDate.php b/src/Entity/Destination.php similarity index 88% rename from src/Entity/BpnDate.php rename to src/Entity/Destination.php index f2b63ee..2e89e1f 100644 --- a/src/Entity/BpnDate.php +++ b/src/Entity/Destination.php @@ -2,12 +2,12 @@ namespace App\Entity; -use App\Repository\BpnDateRepository; +use App\Repository\DestinationRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; -#[ORM\Entity(repositoryClass: BpnDateRepository::class)] -class BpnDate +#[ORM\Entity(repositoryClass: DestinationRepository::class)] +class Destination { #[ORM\Id] #[ORM\GeneratedValue] @@ -26,9 +26,6 @@ class BpnDate #[ORM\Column(type: Types::DATE_IMMUTABLE)] private ?\DateTimeImmutable $dateTo = null; - #[ORM\Column] - private ?bool $bus; - #[ORM\Column(length: 255)] private ?string $product = null; @@ -44,11 +41,6 @@ class BpnDate #[ORM\Column] private array $pickups = []; - public function __construct() - { - $this->bus = false; - } - public function __toString(): string { return sprintf('%s - %s: %s, %s', @@ -100,18 +92,6 @@ class BpnDate return $this; } - public function isBus(): ?bool - { - return $this->bus; - } - - public function setBus(bool $bus): static - { - $this->bus = $bus; - - return $this; - } - public function getCode(): ?string { return $this->code; @@ -183,4 +163,9 @@ class BpnDate return $this; } + + public function hasBusTransfer(): bool + { + return 0 < count($this->getPickups()); + } } diff --git a/src/Entity/DispositionRequirement.php b/src/Entity/DispositionRequirement.php deleted file mode 100644 index 2fe81dc..0000000 --- a/src/Entity/DispositionRequirement.php +++ /dev/null @@ -1,66 +0,0 @@ -id; - } - - public function getTraining(): ?Training - { - return $this->training; - } - - public function setTraining(?Training $training): static - { - $this->training = $training; - - return $this; - } - - public function getPickupDate(): ?\DateTimeImmutable - { - return $this->pickupDate; - } - - public function setPickupDate(?\DateTimeImmutable $pickupDate): static - { - $this->pickupDate = $pickupDate; - - return $this; - } - - public function getAssignment(): ?Assignment - { - return $this->assignment; - } - - public function setAssignment(?Assignment $assignment): static - { - $this->assignment = $assignment; - - return $this; - } -} diff --git a/src/Form/AssignmentType.php b/src/Form/AssignmentType.php index b32ff7e..1b90075 100644 --- a/src/Form/AssignmentType.php +++ b/src/Form/AssignmentType.php @@ -3,7 +3,7 @@ namespace App\Form; use App\Entity\Assignment; -use App\Entity\BpnDate; +use App\Entity\Destination; use App\Entity\Fee; use App\Entity\JobProfile; use App\Entity\User; @@ -28,11 +28,9 @@ class AssignmentType extends AbstractType ]) ->add('destination', AutocompleteEntityType::class, [ 'label' => 'Destination', - 'class' => BpnDate::class, + 'class' => Destination::class, 'label_property' => 'product', - 'label_function' => function (BpnDate $date) { - return (string) $date; - }, + 'label_function' => fn(Destination $destination) => (string) $destination, 'endpoint_route' => 'app_admin_autocomplete_bpndate', ]) ->add('jobProfile', EntityType::class, [ diff --git a/src/Form/TeamerProfileType.php b/src/Form/TeamerProfileType.php index a0adc3c..1165fbb 100644 --- a/src/Form/TeamerProfileType.php +++ b/src/Form/TeamerProfileType.php @@ -24,7 +24,7 @@ class TeamerProfileType extends AbstractType ->add('gender', ChoiceType::class, [ 'label' => 'Geschlecht', 'choices' => [ - 'weiblich' => 'W', + 'weiblich' => 'F', 'männlich' => 'M', 'divers' => 'D', ], @@ -50,6 +50,7 @@ class TeamerProfileType extends AbstractType ->add('dateOfBirth', BirthdayType::class, [ 'label' => 'Geburtsdatum', 'input_format' => 'datetime_immutable', + 'widget' => 'choice', ]) ->add('nationality', BpnCountryType::class, [ 'label' => 'Nationalität', diff --git a/src/Repository/BpnDateRepository.php b/src/Repository/DestinationRepository.php similarity index 55% rename from src/Repository/BpnDateRepository.php rename to src/Repository/DestinationRepository.php index 62c14e8..6701e38 100644 --- a/src/Repository/BpnDateRepository.php +++ b/src/Repository/DestinationRepository.php @@ -2,41 +2,41 @@ namespace App\Repository; -use App\Entity\BpnDate; +use App\Entity\Destination; use App\Repository\Traits\QueryHelperTrait; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Persistence\ManagerRegistry; /** - * @extends ServiceEntityRepository + * @extends ServiceEntityRepository * - * @method BpnDate|null find($id, $lockMode = null, $lockVersion = null) - * @method BpnDate|null findOneBy(array $criteria, array $orderBy = null) - * @method BpnDate[] findAll() - * @method BpnDate[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) + * @method Destination|null find($id, $lockMode = null, $lockVersion = null) + * @method Destination|null findOneBy(array $criteria, array $orderBy = null) + * @method Destination[] findAll() + * @method Destination[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) */ -class BpnDateRepository extends ServiceEntityRepository +class DestinationRepository extends ServiceEntityRepository { use QueryHelperTrait; public function __construct(ManagerRegistry $registry) { - parent::__construct($registry, BpnDate::class); + parent::__construct($registry, Destination::class); } public function getAutocompletionData(string $search): array { - $qb = $this->createQueryBuilder('bpn_date'); + $qb = $this->createQueryBuilder('destination'); $dates = $qb ->where($qb->expr()->orX( - $qb->expr()->like('bpn_date.product', ':product'), - $qb->expr()->like('bpn_date.hotel', ':hotel') + $qb->expr()->like('destination.product', ':product'), + $qb->expr()->like('destination.hotel', ':hotel') )) ->setParameter('product', '%'.$this->escapeLikeWildcards($search).'%') ->setParameter('hotel', '%'.$this->escapeLikeWildcards($search).'%') - ->orderBy('bpn_date.dateFrom', 'ASC') - ->addOrderBy('bpn_date.product', 'ASC') + ->orderBy('destination.dateFrom', 'ASC') + ->addOrderBy('destination.product', 'ASC') ->getQuery() ->getResult() ; diff --git a/src/Repository/DispositionRequirementRepository.php b/src/Repository/DispositionRequirementRepository.php deleted file mode 100644 index 298db93..0000000 --- a/src/Repository/DispositionRequirementRepository.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * @method DispositionRequirement|null find($id, $lockMode = null, $lockVersion = null) - * @method DispositionRequirement|null findOneBy(array $criteria, array $orderBy = null) - * @method DispositionRequirement[] findAll() - * @method DispositionRequirement[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) - */ -class DispositionRequirementRepository extends ServiceEntityRepository -{ - public function __construct(ManagerRegistry $registry) - { - parent::__construct($registry, DispositionRequirement::class); - } - - public function save(DispositionRequirement $entity, bool $flush = false): void - { - $this->getEntityManager()->persist($entity); - - if ($flush) { - $this->getEntityManager()->flush(); - } - } - - public function remove(DispositionRequirement $entity, bool $flush = false): void - { - $this->getEntityManager()->remove($entity); - - if ($flush) { - $this->getEntityManager()->flush(); - } - } - -// /** -// * @return DispositionRequirement[] Returns an array of DispositionRequirement objects -// */ -// public function findByExampleField($value): array -// { -// return $this->createQueryBuilder('d') -// ->andWhere('d.exampleField = :val') -// ->setParameter('val', $value) -// ->orderBy('d.id', 'ASC') -// ->setMaxResults(10) -// ->getQuery() -// ->getResult() -// ; -// } - -// public function findOneBySomeField($value): ?DispositionRequirement -// { -// return $this->createQueryBuilder('d') -// ->andWhere('d.exampleField = :val') -// ->setParameter('val', $value) -// ->getQuery() -// ->getOneOrNullResult() -// ; -// } -}