Compare commits

..

3 Commits

Author SHA1 Message Date
Sergio Álvarez 2a5ee7b16b
platform dupped 2022-05-25 12:05:39 +02:00
Sergio Álvarez 258c79b954
product as OneToOne 2022-05-25 09:54:28 +02:00
Sergio Álvarez 937c2a459d
not working 2022-05-24 17:07:26 +02:00
27 changed files with 189 additions and 687 deletions

2
.env
View File

@ -24,5 +24,5 @@ APP_SECRET=927b6476c39dc61a41e55ee144b865f2
# #
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db" # DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7&charset=utf8mb4" # DATABASE_URL="mysql://db_user:db_password@127.0.0.1:3306/db_name?serverVersion=5.7&charset=utf8mb4"
DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db" DATABASE_URL="sqlite:///%kernel.project_dir%/var/app2.db"
###< doctrine/doctrine-bundle ### ###< doctrine/doctrine-bundle ###

View File

@ -1,31 +0,0 @@
<?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 Version20220520203412 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE entity1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, 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('DROP TABLE entity1');
}
}

View File

@ -1,34 +0,0 @@
<?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 Version20220522111615 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('CREATE TABLE toothbrush1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE employee1');
$this->addSql('DROP TABLE toothbrush1');
}
}

View File

@ -1,48 +0,0 @@
<?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 Version20220522115037 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL)');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
$this->addSql('CREATE TABLE toothbrush2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL)');
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT FK_2250E3BCA25DC38 FOREIGN KEY (toothbrush1_id) REFERENCES toothbrush1 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE person2');
$this->addSql('DROP TABLE toothbrush2');
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
}
}

View File

@ -1,64 +0,0 @@
<?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 Version20220522153147 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE employee3 (id INTEGER NOT NULL, job VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE person3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush3_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D4808643A02C14B3 ON person3 (toothbrush3_id)');
$this->addSql('CREATE TABLE toothbrush3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL)');
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT FK_2250E3BCA25DC38 FOREIGN KEY (toothbrush1_id) REFERENCES toothbrush1 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('DROP INDEX IDX_A387B6D5189073D6');
$this->addSql('CREATE TEMPORARY TABLE __temp__person2 AS SELECT id, toothbrush2_id, age, name, discr, job FROM person2');
$this->addSql('DROP TABLE person2');
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL, CONSTRAINT FK_A387B6D5189073D6 FOREIGN KEY (toothbrush2_id) REFERENCES toothbrush2 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO person2 (id, toothbrush2_id, age, name, discr, job) SELECT id, toothbrush2_id, age, name, discr, job FROM __temp__person2');
$this->addSql('DROP TABLE __temp__person2');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE employee3');
$this->addSql('DROP TABLE person3');
$this->addSql('DROP TABLE toothbrush3');
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('DROP INDEX IDX_A387B6D5189073D6');
$this->addSql('CREATE TEMPORARY TABLE __temp__person2 AS SELECT id, toothbrush2_id, age, name, discr, job FROM person2');
$this->addSql('DROP TABLE person2');
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO person2 (id, toothbrush2_id, age, name, discr, job) SELECT id, toothbrush2_id, age, name, discr, job FROM __temp__person2');
$this->addSql('DROP TABLE __temp__person2');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
}
}

View File

@ -1,81 +0,0 @@
<?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 Version20220522154942 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, CONSTRAINT FK_2250E3BCA25DC38 FOREIGN KEY (toothbrush1_id) REFERENCES toothbrush1 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee3 AS SELECT id, job FROM employee3');
$this->addSql('DROP TABLE employee3');
$this->addSql('CREATE TABLE employee3 (id INTEGER NOT NULL, job VARCHAR(255) NOT NULL, PRIMARY KEY(id), CONSTRAINT FK_CC5E8290BF396750 FOREIGN KEY (id) REFERENCES person3 (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO employee3 (id, job) SELECT id, job FROM __temp__employee3');
$this->addSql('DROP TABLE __temp__employee3');
$this->addSql('DROP INDEX IDX_A387B6D5189073D6');
$this->addSql('CREATE TEMPORARY TABLE __temp__person2 AS SELECT id, toothbrush2_id, age, name, discr, job FROM person2');
$this->addSql('DROP TABLE person2');
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL, CONSTRAINT FK_A387B6D5189073D6 FOREIGN KEY (toothbrush2_id) REFERENCES toothbrush2 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO person2 (id, toothbrush2_id, age, name, discr, job) SELECT id, toothbrush2_id, age, name, discr, job FROM __temp__person2');
$this->addSql('DROP TABLE __temp__person2');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
$this->addSql('DROP INDEX UNIQ_D4808643A02C14B3');
$this->addSql('CREATE TEMPORARY TABLE __temp__person3 AS SELECT id, toothbrush3_id, age, name, discr FROM person3');
$this->addSql('DROP TABLE person3');
$this->addSql('CREATE TABLE person3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush3_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, CONSTRAINT FK_D4808643A02C14B3 FOREIGN KEY (toothbrush3_id) REFERENCES toothbrush3 (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO person3 (id, toothbrush3_id, age, name, discr) SELECT id, toothbrush3_id, age, name, discr FROM __temp__person3');
$this->addSql('DROP TABLE __temp__person3');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D4808643A02C14B3 ON person3 (toothbrush3_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_2250E3BCA25DC38');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee1 AS SELECT id, toothbrush1_id, job, age, name FROM employee1');
$this->addSql('DROP TABLE employee1');
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO employee1 (id, toothbrush1_id, job, age, name) SELECT id, toothbrush1_id, job, age, name FROM __temp__employee1');
$this->addSql('DROP TABLE __temp__employee1');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('CREATE TEMPORARY TABLE __temp__employee3 AS SELECT id, job FROM employee3');
$this->addSql('DROP TABLE employee3');
$this->addSql('CREATE TABLE employee3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, job VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO employee3 (id, job) SELECT id, job FROM __temp__employee3');
$this->addSql('DROP TABLE __temp__employee3');
$this->addSql('DROP INDEX IDX_A387B6D5189073D6');
$this->addSql('CREATE TEMPORARY TABLE __temp__person2 AS SELECT id, toothbrush2_id, age, name, discr, job FROM person2');
$this->addSql('DROP TABLE person2');
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL, job VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO person2 (id, toothbrush2_id, age, name, discr, job) SELECT id, toothbrush2_id, age, name, discr, job FROM __temp__person2');
$this->addSql('DROP TABLE __temp__person2');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
$this->addSql('DROP INDEX UNIQ_D4808643A02C14B3');
$this->addSql('CREATE TEMPORARY TABLE __temp__person3 AS SELECT id, toothbrush3_id, age, name, discr FROM person3');
$this->addSql('DROP TABLE person3');
$this->addSql('CREATE TABLE person3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush3_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL, discr VARCHAR(255) NOT NULL)');
$this->addSql('INSERT INTO person3 (id, toothbrush3_id, age, name, discr) SELECT id, toothbrush3_id, age, name, discr FROM __temp__person3');
$this->addSql('DROP TABLE __temp__person3');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D4808643A02C14B3 ON person3 (toothbrush3_id)');
}
}

View File

@ -1,49 +0,0 @@
<?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 Version20220523093709 extends AbstractMigration
{
public function getDescription(): string
{
return 'Mer* simulation and cleanup';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json)
, discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, offer_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, service_id VARCHAR(255) DEFAULT NULL)');
$this->addSql('DROP TABLE employee1');
$this->addSql('DROP TABLE employee3');
$this->addSql('DROP TABLE person2');
$this->addSql('DROP TABLE person3');
$this->addSql('DROP TABLE toothbrush1');
$this->addSql('DROP TABLE toothbrush2');
$this->addSql('DROP TABLE toothbrush3');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE employee1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush1_id INTEGER DEFAULT NULL, job VARCHAR(255) NOT NULL COLLATE BINARY, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_2250E3BCA25DC38 ON employee1 (toothbrush1_id)');
$this->addSql('CREATE TABLE employee3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, job VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('CREATE TABLE person2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush2_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY, discr VARCHAR(255) NOT NULL COLLATE BINARY, job VARCHAR(255) DEFAULT NULL COLLATE BINARY)');
$this->addSql('CREATE INDEX IDX_A387B6D5189073D6 ON person2 (toothbrush2_id)');
$this->addSql('CREATE TABLE person3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, toothbrush3_id INTEGER DEFAULT NULL, age INTEGER NOT NULL, name VARCHAR(255) NOT NULL COLLATE BINARY, discr VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_D4808643A02C14B3 ON person3 (toothbrush3_id)');
$this->addSql('CREATE TABLE toothbrush1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('CREATE TABLE toothbrush2 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('CREATE TABLE toothbrush3 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, brand VARCHAR(255) NOT NULL COLLATE BINARY)');
$this->addSql('DROP TABLE mer_service');
}
}

View File

@ -1,36 +0,0 @@
<?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 Version20220523110817 extends AbstractMigration
{
public function getDescription(): string
{
return 'Be* added';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE mer_service ADD COLUMN activation_code VARCHAR(255) DEFAULT NULL');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_service AS SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM mer_service');
$this->addSql('DROP TABLE mer_service');
$this->addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json)
, discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, offer_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, service_id VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO mer_service (id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id) SELECT id, mcc_mnc, metadata, discr, product_code, offer_id, api_key, service_id FROM __temp__mer_service');
$this->addSql('DROP TABLE __temp__mer_service');
}
}

View File

@ -1,32 +0,0 @@
<?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 Version20220523114408 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, red_code VARCHAR(255) DEFAULT NULL)');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE mer_para_sub');
}
}

View File

@ -1,47 +0,0 @@
<?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 Version20220523132530 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
// MODIFICATION NEEDED: added DATETIME() to INSERTS to prevent:
// SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: mer_para_sub.sub_date
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, red_code FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, red_code VARCHAR(255) DEFAULT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, CONSTRAINT FK_E4F82A3DED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, red_code, sub_date) SELECT id, service_id, red_code, DATETIME() FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, red_code FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, red_code VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, red_code) SELECT id, service_id, red_code FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
}

View File

@ -1,47 +0,0 @@
<?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 Version20220523152033 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, sub_date, unsub_date FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, pin INTEGER DEFAULT NULL, CONSTRAINT FK_E4F82A3DED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, sub_date, unsub_date) SELECT id, service_id, sub_date, unsub_date FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, sub_date, unsub_date FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, red_code VARCHAR(255) DEFAULT NULL)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, sub_date, unsub_date) SELECT id, service_id, sub_date, unsub_date FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
}

View File

@ -1,48 +0,0 @@
<?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 Version20220523155141 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
// Added 'status' to INSERT
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, sub_date, unsub_date, pin FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, CONSTRAINT FK_E4F82A3DED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, sub_date, unsub_date, pin, status) SELECT id, service_id, sub_date, unsub_date, pin, 1 FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, pin, sub_date, unsub_date FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, pin INTEGER DEFAULT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, pin, sub_date, unsub_date) SELECT id, service_id, pin, sub_date, unsub_date FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
}

View File

@ -1,52 +0,0 @@
<?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 Version20220523155631 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE mer_be_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, code VARCHAR(255) DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('CREATE INDEX IDX_CA4C3EB8ED5CA9E6 ON mer_be_sub (service_id)');
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, sub_date, unsub_date, pin, status FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, CONSTRAINT FK_E4F82A3DED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, sub_date, unsub_date, pin, status) SELECT id, service_id, sub_date, unsub_date, pin, status FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE mer_be_sub');
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, pin, status, sub_date, unsub_date FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, pin, status, sub_date, unsub_date) SELECT id, service_id, pin, status, sub_date, unsub_date FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
}

View File

@ -1,65 +0,0 @@
<?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 Version20220524080445 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_CA4C3EB8ED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_be_sub AS SELECT id, service_id, code, status, sub_date, unsub_date FROM mer_be_sub');
$this->addSql('DROP TABLE mer_be_sub');
$this->addSql('CREATE TABLE mer_be_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, code VARCHAR(255) DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, CONSTRAINT FK_CA4C3EB8ED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_be_sub (id, service_id, code, status, sub_date, unsub_date) SELECT id, service_id, code, status, sub_date, unsub_date FROM __temp__mer_be_sub');
$this->addSql('DROP TABLE __temp__mer_be_sub');
$this->addSql('CREATE INDEX IDX_CA4C3EB8ED5CA9E6 ON mer_be_sub (service_id)');
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, sub_date, unsub_date, pin, status FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, CONSTRAINT FK_E4F82A3DED5CA9E6 FOREIGN KEY (service_id) REFERENCES mer_service (id) NOT DEFERRABLE INITIALLY IMMEDIATE)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, sub_date, unsub_date, pin, status) SELECT id, service_id, sub_date, unsub_date, pin, status FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX IDX_CA4C3EB8ED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_be_sub AS SELECT id, service_id, code, status, sub_date, unsub_date FROM mer_be_sub');
$this->addSql('DROP TABLE mer_be_sub');
$this->addSql('CREATE TABLE mer_be_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, code VARCHAR(255) DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('INSERT INTO mer_be_sub (id, service_id, code, status, sub_date, unsub_date) SELECT id, service_id, code, status, sub_date, unsub_date FROM __temp__mer_be_sub');
$this->addSql('DROP TABLE __temp__mer_be_sub');
$this->addSql('CREATE INDEX IDX_CA4C3EB8ED5CA9E6 ON mer_be_sub (service_id)');
$this->addSql('DROP INDEX IDX_E4F82A3DED5CA9E6');
$this->addSql('CREATE TEMPORARY TABLE __temp__mer_para_sub AS SELECT id, service_id, pin, status, sub_date, unsub_date FROM mer_para_sub');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('INSERT INTO mer_para_sub (id, service_id, pin, status, sub_date, unsub_date) SELECT id, service_id, pin, status, sub_date, unsub_date FROM __temp__mer_para_sub');
$this->addSql('DROP TABLE __temp__mer_para_sub');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
}
}

View File

@ -0,0 +1,51 @@
<?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 Version20220525093052 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE entity1 (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, name VARCHAR(255) NOT NULL)');
$this->addSql('CREATE TABLE mer_be_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, code VARCHAR(255) DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('CREATE INDEX IDX_CA4C3EB8ED5CA9E6 ON mer_be_sub (service_id)');
$this->addSql('CREATE TABLE mer_dm (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ott_id INTEGER DEFAULT NULL, offer_id INTEGER NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_C03EF7C6396F71CA ON mer_dm (ott_id)');
$this->addSql('CREATE TABLE mer_dt (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, ott_id INTEGER DEFAULT NULL, service_id VARCHAR(255) NOT NULL)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_A4555F06396F71CA ON mer_dt (ott_id)');
$this->addSql('CREATE TABLE mer_para_sub (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, service_id INTEGER NOT NULL, pin INTEGER DEFAULT NULL, status INTEGER NOT NULL, sub_date DATETIME NOT NULL --(DC2Type:datetime_immutable)
, unsub_date DATETIME DEFAULT NULL --(DC2Type:datetime_immutable)
)');
$this->addSql('CREATE INDEX IDX_E4F82A3DED5CA9E6 ON mer_para_sub (service_id)');
$this->addSql('CREATE TABLE mer_service (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, mcc_mnc INTEGER DEFAULT NULL, metadata CLOB DEFAULT NULL --(DC2Type:json)
, discr VARCHAR(255) NOT NULL, product_code VARCHAR(255) DEFAULT NULL, platform_id INTEGER DEFAULT NULL, api_key VARCHAR(255) DEFAULT NULL, activation_code VARCHAR(255) DEFAULT NULL)');
$this->addSql('CREATE INDEX IDX_E9ABEA72FFE6496F ON mer_service (platform_id)');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP TABLE entity1');
$this->addSql('DROP TABLE mer_be_sub');
$this->addSql('DROP TABLE mer_dm');
$this->addSql('DROP TABLE mer_dt');
$this->addSql('DROP TABLE mer_para_sub');
$this->addSql('DROP TABLE mer_service');
}
}

View File

@ -49,7 +49,7 @@ class IndexController extends AbstractController
{ {
return $this->render('index/notificationDm.html.twig', [ return $this->render('index/notificationDm.html.twig', [
'serviceRepo' => $repo->findByOfferId($request->query->get('offer_id')), 'serviceRepo' => $repo->findByOfferId($request->query->get('offer_id')),
'beDmRepo' => $repoDm->findByOfferId($request->query->get('offer_id')) //'beDmRepo' => $repoDm->findByOfferId($request->query->get('offer_id'))
]); ]);
} }
} }

View File

@ -4,6 +4,8 @@ namespace App\DataFixtures;
use App\Entity\MerBeDM; use App\Entity\MerBeDM;
use App\Entity\MerBeSub; use App\Entity\MerBeSub;
use App\Entity\MerDM;
use App\Entity\MerDT;
use App\Entity\MerParaDM; use App\Entity\MerParaDM;
use App\Entity\MerParaDT; use App\Entity\MerParaDT;
use App\Entity\MerParaSub; use App\Entity\MerParaSub;
@ -17,27 +19,27 @@ class MerFixtures extends Fixture
{ {
$ser1 = new MerParaDM(); $ser1 = new MerParaDM();
$ser1->setMccMnc(12345) $ser1->setMccMnc(12345)
->setOfferId(221) ->setPlatform((new MerDM())->setOfferId(221))
->setProductCode('code1'); ->setProductCode('code1');
$ser2 = new MerParaDM(); $ser2 = new MerParaDM();
$ser2->setMccMnc(12345) $ser2->setMccMnc(12345)
->setOfferId(223) ->setPlatform((new MerDM())->setOfferId(223))
->setProductCode('code2'); ->setProductCode('code2');
$ser3 = new MerParaDT(); $ser3 = new MerParaDT();
$ser3->setMccMnc(12345) $ser3->setMccMnc(12345)
->setServiceId('ser-vi-ce1') ->setPlatform((new MerDT())->setServiceId('ser-vi-ce1'))
->setApiKey('api1'); ->setApiKey('api1');
$ser4 = new MerParaDT(); $ser4 = new MerParaDT();
$ser4->setMccMnc(12341) $ser4->setMccMnc(12341)
->setServiceId('ser-vi-ce2') ->setPlatform((new MerDT())->setServiceId('ser-vi-ce2'))
->setApiKey('api2'); ->setApiKey('api2');
$ser5 = new MerBeDM(); $ser5 = new MerBeDM();
$ser5->setMccMnc(12341) $ser5->setMccMnc(12341)
->setOfferId(112) ->setPlatform((new MerDM())->setOfferId(112))
->setActivationCode('active1'); ->setActivationCode('active1');
$sub1 = new MerParaSub(); $sub1 = new MerParaSub();

View File

@ -6,10 +6,8 @@ use App\Repository\MerBeDMRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerBeDMRepository::class)] #[ORM\Entity(repositoryClass: MerBeDMRepository::class)]
class MerBeDM extends MerService class MerBeDM extends MerService implements OttInterface
{ {
use MerDM;
// #[ORM\Id] // #[ORM\Id]
// #[ORM\GeneratedValue] // #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')] // #[ORM\Column(type: 'integer')]
@ -18,6 +16,9 @@ class MerBeDM extends MerService
#[ORM\Column(type: 'string', length: 255)] #[ORM\Column(type: 'string', length: 255)]
private $activation_code; private $activation_code;
#[ORM\OneToOne(targetEntity: MerDM::class, cascade: ['persist'])]
private MerDM $platform;
// public function getId(): ?int // public function getId(): ?int
// { // {
// return $this->id; // return $this->id;
@ -34,4 +35,16 @@ class MerBeDM extends MerService
return $this; return $this;
} }
public function getPlatform(): ?MerDM
{
return $this->platform;
}
public function setPlatform(?MerDM $platform): self
{
$this->platform = $platform;
return $this;
}
} }

View File

@ -5,21 +5,21 @@ namespace App\Entity;
use App\Repository\MerDMRepository; use App\Repository\MerDMRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDMRepository::class)] #[ORM\Entity(repositoryClass: MerDMRepository::class)]
trait MerDM class MerDM extends Platform
{ {
// #[ORM\Id] #[ORM\Id]
// #[ORM\GeneratedValue] #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')] #[ORM\Column(type: 'integer')]
// private $id; private $id;
#[ORM\Column(type: 'integer')] #[ORM\Column(type: 'integer')]
private $offer_id; private $offer_id;
// public function getId(): ?int public function getId(): ?int
// { {
// return $this->id; return $this->id;
// } }
public function getOfferId(): ?int public function getOfferId(): ?int
{ {

View File

@ -5,21 +5,21 @@ namespace App\Entity;
use App\Repository\MerDTRepository; use App\Repository\MerDTRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDTRepository::class)] #[ORM\Entity(repositoryClass: MerDTRepository::class)]
trait MerDT class MerDT extends Platform
{ {
// #[ORM\Id] #[ORM\Id]
// #[ORM\GeneratedValue] #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')] #[ORM\Column(type: 'integer')]
// private $id; private $id;
#[ORM\Column(type: 'string', length: 255)] #[ORM\Column(type: 'string', length: 255)]
private $service_id; private $service_id;
// public function getId(): ?int public function getId(): ?int
// { {
// return $this->id; return $this->id;
// } }
public function getServiceId(): ?string public function getServiceId(): ?string
{ {

View File

@ -6,10 +6,8 @@ use App\Repository\MerParaDMRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDMRepository::class)] #[ORM\Entity(repositoryClass: MerParaDMRepository::class)]
class MerParaDM extends MerService class MerParaDM extends MerService implements OttInterface
{ {
use MerDM;
// #[ORM\Id] // #[ORM\Id]
// #[ORM\GeneratedValue] // #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')] // #[ORM\Column(type: 'integer')]
@ -18,6 +16,9 @@ class MerParaDM extends MerService
#[ORM\Column(type: 'string', length: 255)] #[ORM\Column(type: 'string', length: 255)]
private $product_code; private $product_code;
#[ORM\OneToOne(targetEntity: MerDM::class, cascade: ['persist'])]
private MerDM $platform;
// public function getId(): ?int // public function getId(): ?int
// { // {
// return $this->id; // return $this->id;
@ -34,4 +35,16 @@ class MerParaDM extends MerService
return $this; return $this;
} }
public function getPlatform(): ?MerDM
{
return $this->platform;
}
public function setPlatform(?MerDM $platform): self
{
$this->platform = $platform;
return $this;
}
} }

View File

@ -6,10 +6,8 @@ use App\Repository\MerParaDTRepository;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDTRepository::class)] #[ORM\Entity(repositoryClass: MerParaDTRepository::class)]
class MerParaDT extends MerService class MerParaDT extends MerService implements OttInterface
{ {
use MerDT;
// #[ORM\Id] // #[ORM\Id]
// #[ORM\GeneratedValue] // #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')] // #[ORM\Column(type: 'integer')]
@ -18,6 +16,9 @@ class MerParaDT extends MerService
#[ORM\Column(type: 'string', length: 255)] #[ORM\Column(type: 'string', length: 255)]
private $api_key; private $api_key;
#[ORM\OneToOne(targetEntity: MerDT::class, cascade: ['persist'])]
private MerDT $platform;
// public function getId(): ?int // public function getId(): ?int
// { // {
// return $this->id; // return $this->id;
@ -34,4 +35,16 @@ class MerParaDT extends MerService
return $this; return $this;
} }
public function getPlatform(): ?MerDT
{
return $this->platform;
}
public function setPlatform(?MerDT $platform): self
{
$this->platform = $platform;
return $this;
}
} }

View File

@ -3,6 +3,7 @@
namespace App\Entity; namespace App\Entity;
use App\Repository\MerServiceRepository; use App\Repository\MerServiceRepository;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
#[ORM\InheritanceType('SINGLE_TABLE')] #[ORM\InheritanceType('SINGLE_TABLE')]

View File

@ -0,0 +1,8 @@
<?php
namespace App\Entity;
interface OttInterface
{
}

25
src/Entity/Platform.php Normal file
View File

@ -0,0 +1,25 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
#[ORM\MappedSuperclass]
class Platform
{
#[ORM\OneToOne(targetEntity: "MerService", inversedBy: "platform")]
#[ORM\JoinColumn(name: "ott_id", referencedColumnName: "id")]
private ?MerService $ott;
public function getOtt(): ?MerService
{
return $this->ott;
}
public function setPlatform(?MerService $ott): self
{
$this->ott = $ott;
return $this;
}
}

View File

@ -2,6 +2,7 @@
namespace App\Repository; namespace App\Repository;
use App\Entity\MerDM;
use App\Entity\MerService; use App\Entity\MerService;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query; use Doctrine\ORM\Query;
@ -80,22 +81,31 @@ class MerServiceRepository extends ServiceEntityRepository
// ->getResult() // ->getResult()
// ; // ;
$rsm = new ResultSetMapping(); // $rsm = new ResultSetMapping();
$rsm->addEntityResult($this->getClassName(), 's'); // $rsm->addEntityResult($this->getClassName(), 's');
$rsm->addFieldResult('s', 'id', 'id'); // $rsm->addFieldResult('s', 'id', 'id');
$rsm->addMetaResult('s', 'discr', 'discr'); // $rsm->addMetaResult('s', 'discr', 'discr');
$rsm->setDiscriminatorColumn('s', 'discr'); // $rsm->setDiscriminatorColumn('s', 'discr');
//
// $query = $this->getEntityManager()
// ->createNativeQuery('SELECT m.id, m.discr FROM mer_service m WHERE offer_id = :offer_id', $rsm);
// $query->setParameter('offer_id', $offerId);
//
// $res = $query->getResult();
//
// foreach ($res as $k => $obj) {
// $this->getEntityManager()->refresh($obj);
// }
//
// return $res;
$query = $this->getEntityManager() return $this->createQueryBuilder('s')
->createNativeQuery('SELECT m.id, m.discr FROM mer_service m WHERE offer_id = :offer_id', $rsm); ->innerJoin(MerDM::class, 'p', )
$query->setParameter('offer_id', $offerId); ->andWhere('p.offer_id = :offer_id')
->andWhere('p.offer_id IS NOT NULL')
$res = $query->getResult(); ->setParameter('offer_id', $offerId)
->getQuery()
foreach ($res as $k => $obj) { ->getResult()
$this->getEntityManager()->refresh($obj); ;
}
return $res;
} }
} }

View File

@ -9,5 +9,5 @@
{{ dump(serviceRepo) }} {{ dump(serviceRepo) }}
<h1>MerBeDMRepository->findByOfferId</h1> <h1>MerBeDMRepository->findByOfferId</h1>
{{ dump(beDmRepo) }} {# {{ dump(beDmRepo) }}#}
{% endblock %} {% endblock %}