Compare commits

...

No commits in common. "main" and "basic-ux" have entirely different histories.

83 changed files with 11479 additions and 4921 deletions

19
.env
View File

@ -9,13 +9,14 @@
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=927b6476c39dc61a41e55ee144b865f2
APP_SECRET=41bb403151be0e889a62b81bb7aba007
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
@ -23,6 +24,18 @@ APP_SECRET=927b6476c39dc61a41e55ee144b865f2
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# 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="sqlite:///%kernel.project_dir%/var/app.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8.0.32&charset=utf8mb4"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=10.11.2-MariaDB&charset=utf8mb4"
DATABASE_URL="postgresql://app:!ChangeMe!@127.0.0.1:5432/app?serverVersion=15&charset=utf8"
###< doctrine/doctrine-bundle ###
###> symfony/messenger ###
# Choose one of the transports below
# MESSENGER_TRANSPORT_DSN=amqp://guest:guest@localhost:5672/%2f/messages
# MESSENGER_TRANSPORT_DSN=redis://localhost:6379/messages
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
###< symfony/messenger ###
###> symfony/mailer ###
# MAILER_DSN=null://null
###< symfony/mailer ###

6
.env.test Normal file
View File

@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

20
.gitignore vendored
View File

@ -8,4 +8,22 @@
/var/
/vendor/
###< symfony/framework-bundle ###
.idea/
###> phpunit/phpunit ###
/phpunit.xml
.phpunit.result.cache
###< phpunit/phpunit ###
###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
###> symfony/webpack-encore-bundle ###
/node_modules/
/public/build/
npm-debug.log
yarn-error.log
###< symfony/webpack-encore-bundle ###
.idea/

View File

@ -1,10 +1,17 @@
```
symfony server:start
symfony console list make
Symfony Playground
symfony console make:migration
symfony console doctrine:migrations:migrate
symfony console doctrine:migrations:up-to-date
Main installation:
symfony console doctrine:fixtures:load
```
- Symfony 6.3
- symfony/webpack-encore-bundle
- Home controller /
- Bootstrap 5
- jQuery
- SASS
Run:
- yarn dev-server
- symfony serve
http://localhost:8000

22
assets/app.js Normal file
View File

@ -0,0 +1,22 @@
/*
* Welcome to your app's main JavaScript file!
*
* We recommend including the built version of this JavaScript file
* (and its CSS file) in your base layout (base.html.twig).
*/
// any CSS you import will output into a single css file (app.css in this case)
import './styles/app.scss';
const $ = require('jquery');
// this "modifies" the jquery module: adding behavior to it
// the bootstrap module doesn't export/return anything
require('bootstrap');
// or you can include specific pieces
// require('bootstrap/js/dist/tooltip');
// require('bootstrap/js/dist/popover');
$(document).ready(function() {
$('[data-toggle="popover"]').popover();
});

4
assets/styles/app.scss Normal file
View File

@ -0,0 +1,4 @@
$primary: darken(#428bca, 20%);
// the ~ allows you to reference things in node_modules
@import "~bootstrap/scss/bootstrap";

19
bin/phpunit Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}
if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}
require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}

View File

@ -7,35 +7,47 @@
"php": ">=8.1",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/doctrine-bundle": "^2.6",
"doctrine/doctrine-bundle": "^2.10",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.12",
"symfony/console": "6.0.*",
"symfony/dotenv": "6.0.*",
"doctrine/orm": "^2.16",
"phpdocumentor/reflection-docblock": "^5.3",
"phpstan/phpdoc-parser": "^1.24",
"symfony/asset": "6.3.*",
"symfony/console": "6.3.*",
"symfony/doctrine-messenger": "6.3.*",
"symfony/dotenv": "6.3.*",
"symfony/expression-language": "6.3.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "6.0.*",
"symfony/proxy-manager-bridge": "6.0.*",
"symfony/runtime": "6.0.*",
"symfony/yaml": "6.0.*"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.4",
"symfony/debug-bundle": "6.0.*",
"symfony/maker-bundle": "^1.43",
"symfony/form": "6.3.*",
"symfony/framework-bundle": "6.3.*",
"symfony/http-client": "6.3.*",
"symfony/intl": "6.3.*",
"symfony/mailer": "6.3.*",
"symfony/mime": "6.3.*",
"symfony/monolog-bundle": "^3.0",
"symfony/stopwatch": "6.0.*",
"symfony/web-profiler-bundle": "6.0.*"
"symfony/notifier": "6.3.*",
"symfony/process": "6.3.*",
"symfony/property-access": "6.3.*",
"symfony/property-info": "6.3.*",
"symfony/runtime": "6.3.*",
"symfony/security-bundle": "6.3.*",
"symfony/serializer": "6.3.*",
"symfony/string": "6.3.*",
"symfony/translation": "6.3.*",
"symfony/twig-bundle": "6.3.*",
"symfony/validator": "6.3.*",
"symfony/web-link": "6.3.*",
"symfony/webpack-encore-bundle": "^2.1",
"symfony/yaml": "6.3.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
@ -54,7 +66,8 @@
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*"
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*"
},
"scripts": {
"auto-scripts": {
@ -74,7 +87,17 @@
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.0.*"
"require": "6.3.*"
}
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"symfony/browser-kit": "6.3.*",
"symfony/css-selector": "6.3.*",
"symfony/debug-bundle": "6.3.*",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "^6.3",
"symfony/stopwatch": "6.3.*",
"symfony/web-profiler-bundle": "6.3.*"
}
}

8472
composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,14 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Symfony\WebpackEncoreBundle\WebpackEncoreBundle::class => ['all' => true],
];

View File

@ -4,9 +4,14 @@ doctrine:
# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '13'
#server_version: '15'
profiling_collect_backtrace: '%kernel.debug%'
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
@ -26,6 +31,7 @@ when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool

View File

@ -3,4 +3,4 @@ doctrine_migrations:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/migrations'
enable_profiler: '%kernel.debug%'
enable_profiler: false

View File

@ -3,6 +3,7 @@ framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: false
handle_all_throwables: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.

View File

@ -0,0 +1,3 @@
framework:
mailer:
dsn: '%env(MAILER_DSN)%'

View File

@ -0,0 +1,24 @@
framework:
messenger:
failure_transport: failed
transports:
# https://symfony.com/doc/current/messenger.html#transport-configuration
async:
dsn: '%env(MESSENGER_TRANSPORT_DSN)%'
options:
use_notify: true
check_delayed_interval: 60000
retry_strategy:
max_retries: 3
multiplier: 2
failed: 'doctrine://default?queue_name=failed'
# sync: 'sync://'
routing:
Symfony\Component\Mailer\Messenger\SendEmailMessage: async
Symfony\Component\Notifier\Message\ChatMessage: async
Symfony\Component\Notifier\Message\SmsMessage: async
# Route your messages to the transports
# 'App\Message\YourMessage': async

View File

@ -0,0 +1,12 @@
framework:
notifier:
chatter_transports:
texter_transports:
channel_policy:
# use chat/slack, chat/telegram, sms/twilio or sms/nexmo
urgent: ['email']
high: ['email']
medium: ['email']
low: ['email']
admin_recipients:
- { email: admin@example.com }

View File

@ -0,0 +1,39 @@
security:
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
password_hashers:
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
providers:
users_in_memory: { memory: null }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: users_in_memory
# activate different ways to authenticate
# https://symfony.com/doc/current/security.html#the-firewall
# https://symfony.com/doc/current/security/impersonating_user.html
# switch_user: true
# Easy way to control access for large sections of your site
# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/profile, roles: ROLE_USER }
when@test:
security:
password_hashers:
# By default, password hashers are resource intensive and take time. This is
# important to generate secure password hashes. In tests however, secure hashes
# are not important, waste resources and increase test times. The following
# reduces the work factor to the lowest possible values.
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
algorithm: auto
cost: 4 # Lowest possible value for bcrypt
time_cost: 3 # Lowest possible value for argon
memory_cost: 10 # Lowest possible value for argon

View File

@ -0,0 +1,15 @@
framework:
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- en
# providers:
# crowdin:
# dsn: '%env(CROWDIN_DSN)%'
# loco:
# dsn: '%env(LOCO_DSN)%'
# lokalise:
# dsn: '%env(LOKALISE_DSN)%'
# phrase:
# dsn: '%env(PHRASE_DSN)%'

View File

@ -0,0 +1,13 @@
framework:
validation:
email_validation_mode: html5
# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
when@test:
framework:
validation:
not_compromised_password: false

View File

@ -4,7 +4,9 @@ when@dev:
intercept_redirects: false
framework:
profiler: { only_exceptions: false }
profiler:
only_exceptions: false
collect_serializer_data: true
when@test:
web_profiler:

View File

@ -0,0 +1,45 @@
webpack_encore:
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
output_path: '%kernel.project_dir%/public/build'
# If multiple builds are defined (as shown below), you can disable the default build:
# output_path: false
# Set attributes that will be rendered on all script and link tags
script_attributes:
defer: true
# Uncomment (also under link_attributes) if using Turbo Drive
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
# 'data-turbo-track': reload
# link_attributes:
# Uncomment if using Turbo Drive
# 'data-turbo-track': reload
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
# crossorigin: 'anonymous'
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
# preload: true
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
# strict_mode: false
# If you have multiple builds:
# builds:
# frontend: '%kernel.project_dir%/public/frontend/build'
# pass the build name as the 3rd argument to the Twig functions
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
#when@prod:
# webpack_encore:
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
# # Available in version 1.2
# cache: true
#when@test:
# webpack_encore:
# strict_mode: false

View File

@ -1,7 +1,5 @@
controllers:
resource: ../src/Controller/
type: annotation
kernel:
resource: ../src/Kernel.php
type: annotation
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute

View File

@ -0,0 +1,14 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
ports:
- "5432"
###< doctrine/doctrine-bundle ###
###> symfony/mailer ###
mailer:
image: schickling/mailcatcher
ports: ["1025", "1080"]
###< symfony/mailer ###

21
docker-compose.yml Normal file
View File

@ -0,0 +1,21 @@
version: '3'
services:
###> doctrine/doctrine-bundle ###
database:
image: postgres:${POSTGRES_VERSION:-15}-alpine
environment:
POSTGRES_DB: ${POSTGRES_DB:-app}
# You should definitely change the password in production
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
POSTGRES_USER: ${POSTGRES_USER:-app}
volumes:
- database_data:/var/lib/postgresql/data:rw
# You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
# - ./docker/db/data:/var/lib/postgresql/data:rw
###< doctrine/doctrine-bundle ###
volumes:
###> doctrine/doctrine-bundle ###
database_data:
###< 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)');
}
}

25
package.json Normal file
View File

@ -0,0 +1,25 @@
{
"devDependencies": {
"@babel/core": "^7.17.0",
"@babel/preset-env": "^7.16.0",
"@popperjs/core": "^2.11.8",
"@symfony/webpack-encore": "^4.0.0",
"bootstrap": "^5.3.2",
"core-js": "^3.23.0",
"jquery": "^3.7.1",
"regenerator-runtime": "^0.13.9",
"sass": "^1.68.0",
"sass-loader": "^13.0.0",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0",
"webpack-notifier": "^1.15.0"
},
"license": "UNLICENSED",
"private": true,
"scripts": {
"dev-server": "encore dev-server",
"dev": "encore dev",
"watch": "encore dev --watch",
"build": "encore production --progress"
}
}

38
phpunit.xml.dist Normal file
View File

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- https://phpunit.readthedocs.io/en/latest/configuration.html -->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
backupGlobals="false"
colors="true"
bootstrap="tests/bootstrap.php"
convertDeprecationsToExceptions="false"
>
<php>
<ini name="display_errors" value="1" />
<ini name="error_reporting" value="-1" />
<server name="APP_ENV" value="test" force="true" />
<server name="SHELL_VERBOSITY" value="-1" />
<server name="SYMFONY_PHPUNIT_REMOVE" value="" />
<server name="SYMFONY_PHPUNIT_VERSION" value="9.5" />
</php>
<testsuites>
<testsuite name="Project Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
<extensions>
</extensions>
</phpunit>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,18 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
class HomeController extends AbstractController
{
#[Route('/', name: 'app_home')]
public function index(): Response
{
return $this->render('home/index.html.twig', [
'controller_name' => 'HomeController',
]);
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Controller;
use App\Repository\MerBeDMRepository;
use App\Repository\MerBeSubRepository;
use App\Repository\MerParaSubRepository;
use App\Repository\MerServiceRepository;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use App\Repository\Entity1Repository;
class IndexController extends AbstractController
{
#[Route('/', name: 'app_index')]
public function index(
Entity1Repository $repo,
MerParaSubRepository $paraSubRepo,
MerBeSubRepository $beSubRepo
): Response
{
// repo dummy
$sm = $repo->getSchemaManager();
foreach ($paraSubRepo->findAll() as $sub) {
dump($sub);
}
dump('-------------------');
foreach ($beSubRepo->findAll() as $sub) {
dump($sub);
}
return $this->render('index/index.html.twig', [
'schemaManager' => $sm,
//'offer_id' => $sub->getService()->ge
]);
}
#[Route('/notification/dm', name: 'notification_dm')]
public function notificationDm(
Request $request,
MerServiceRepository $repo,
MerBeDMRepository $repoDm
): Response
{
return $this->render('index/notificationDm.html.twig', [
'serviceRepo' => $repo->findByOfferId($request->query->get('offer_id')),
'beDmRepo' => $repoDm->findByOfferId($request->query->get('offer_id'))
]);
}
}

View File

@ -1,23 +0,0 @@
<?php
namespace App\DataFixtures;
use App\Entity\Entity1;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class AppFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
for ($i = 0; $i < 20; $i++) {
$e = new Entity1();
$e->setName('entity '.$i);
$manager->persist($e);
}
$manager->flush();
}
}
// symfony console doctrine:fixtures:load

View File

@ -1,46 +0,0 @@
<?php
namespace App\DataFixtures;
use App\Entity\Employee1;
use App\Entity\Employee2;
use App\Entity\Employee3;
use App\Entity\Toothbrush1;
use App\Entity\Toothbrush2;
use App\Entity\Toothbrush3;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class InheritanceFixtures //extends Fixture
{
public function load(ObjectManager $manager): void
{
$e1 = new Employee1();
$e1->setJob('peon1')->setName('pepito1')->setAge(20)->setToothbrush((new Toothbrush1())->setBrand('colgate1'));
$manager->persist($e1);
$e1 = new Employee1();
$e1->setJob('jefe1')->setName('benganito1')->setAge(30)->setToothbrush((new Toothbrush1())->setBrand('signal1'));
$manager->persist($e1);
$e2 = new Employee2();
$e2->setJob('peon2')->setName('pepito2')->setAge(20)->setToothbrush((new Toothbrush2())->setBrand('colgate2'));
$manager->persist($e2);
$e2 = new Employee2();
$e2->setJob('jefe2')->setName('benganito2')->setAge(30)->setToothbrush((new Toothbrush2())->setBrand('signal2'));
$manager->persist($e2);
$e3 = new Employee3();
$e3->setJob('peon3')->setName('pepito3')->setAge(20)->setToothbrush((new Toothbrush3())->setBrand('colgate3'));
$manager->persist($e3);
$e3 = new Employee3();
$e3->setJob('jefe3')->setName('benganito3')->setAge(30)->setToothbrush((new Toothbrush3())->setBrand('signal3'));
$manager->persist($e3);
$manager->flush();
}
}
// symfony console doctrine:fixtures:load

View File

@ -1,82 +0,0 @@
<?php
namespace App\DataFixtures;
use App\Entity\MerBeDM;
use App\Entity\MerBeSub;
use App\Entity\MerParaDM;
use App\Entity\MerParaDT;
use App\Entity\MerParaSub;
use App\Enum\SubStatus;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
class MerFixtures extends Fixture
{
public function load(ObjectManager $manager): void
{
$ser1 = new MerParaDM();
$ser1->setMccMnc(12345)
->setOfferId(221)
->setProductCode('code1');
$ser2 = new MerParaDM();
$ser2->setMccMnc(12345)
->setOfferId(223)
->setProductCode('code2');
$ser3 = new MerParaDT();
$ser3->setMccMnc(12345)
->setServiceId('ser-vi-ce1')
->setApiKey('api1');
$ser4 = new MerParaDT();
$ser4->setMccMnc(12341)
->setServiceId('ser-vi-ce2')
->setApiKey('api2');
$ser5 = new MerBeDM();
$ser5->setMccMnc(12341)
->setOfferId(112)
->setActivationCode('active1');
$sub1 = new MerParaSub();
$sub1->setService($ser1)
->setStatus(SubStatus::ACTIVE)
->setPin(1122)
->setSubDate(new \DateTimeImmutable('now'));
$sub2 = new MerParaSub();
$sub2->setService($ser3)
->setStatus(SubStatus::PREREGISTERED)
->setPin(2211)
->setSubDate(new \DateTimeImmutable('now'));
$sub3 = new MerParaSub();
$sub3->setService($ser3)
->setStatus(SubStatus::CANCELLED)
->setSubDate(new \DateTimeImmutable('yesterday'))
->setUnsubDate(new \DateTimeImmutable('now'));
$sub4 = new MerBeSub();
$sub4->setService($ser5)
->setStatus(SubStatus::REGISTERED)
->setCode('CoDe')
->setSubDate(new \DateTimeImmutable('now'));
$manager->persist($ser1);
$manager->persist($ser2);
$manager->persist($ser3);
$manager->persist($ser4);
$manager->persist($ser5);
$manager->persist($sub1);
$manager->persist($sub2);
$manager->persist($sub3);
$manager->persist($sub4);
$manager->flush();
}
}
// symfony console doctrine:fixtures:load

View File

@ -1,55 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Employee1 extends Person1
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $job;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Employee1
*/
public function setId(int $id): Employee1
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getJob(): string
{
return $this->job;
}
/**
* @param string $job
* @return Employee1
*/
public function setJob(string $job): Employee1
{
$this->job = $job;
return $this;
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Employee2 extends Person2
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $job;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Employee2
*/
public function setId(int $id): Employee2
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getJob(): string
{
return $this->job;
}
/**
* @param string $job
* @return Employee2
*/
public function setJob(string $job): Employee2
{
$this->job = $job;
return $this;
}
}

View File

@ -1,55 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Employee3 extends Person3
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $job;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Employee3
*/
public function setId(int $id): Employee3
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getJob(): string
{
return $this->job;
}
/**
* @param string $job
* @return Employee3
*/
public function setJob(string $job): Employee3
{
$this->job = $job;
return $this;
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\Entity1Repository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: Entity1Repository::class)]
class Entity1
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255)]
private $name;
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerBeDMRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerBeDMRepository::class)]
class MerBeDM extends MerService
{
use MerDM;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $activation_code;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getActivationCode(): ?string
{
return $this->activation_code;
}
public function setActivationCode(string $activationCode): self
{
$this->activation_code = $activationCode;
return $this;
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerParaSubRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity]
class MerBeSub
{
use MerSubBaseTrait;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $code;
public function getCode(): ?int
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerDMRepository;
use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDMRepository::class)]
trait MerDM
{
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'integer')]
private $offer_id;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getOfferId(): ?int
{
return $this->offer_id;
}
public function setOfferId(int $offerId): self
{
$this->offer_id = $offerId;
return $this;
}
}

View File

@ -1,35 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerDTRepository;
use Doctrine\ORM\Mapping as ORM;
//#[ORM\Entity(repositoryClass: MerDTRepository::class)]
trait MerDT
{
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $service_id;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getServiceId(): ?string
{
return $this->service_id;
}
public function setServiceId(string $serviceId): self
{
$this->service_id = $serviceId;
return $this;
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerParaDMRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDMRepository::class)]
class MerParaDM extends MerService
{
use MerDM;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $product_code;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getProductCode(): ?string
{
return $this->product_code;
}
public function setProductCode(string $productCode): self
{
$this->product_code = $productCode;
return $this;
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerParaDTRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaDTRepository::class)]
class MerParaDT extends MerService
{
use MerDT;
// #[ORM\Id]
// #[ORM\GeneratedValue]
// #[ORM\Column(type: 'integer')]
// private $id;
#[ORM\Column(type: 'string', length: 255)]
private $api_key;
// public function getId(): ?int
// {
// return $this->id;
// }
public function getApiKey(): ?string
{
return $this->api_key;
}
public function setApiKey(string $apiKey): self
{
$this->api_key = $apiKey;
return $this;
}
}

View File

@ -1,27 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerParaSubRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: MerParaSubRepository::class)]
class MerParaSub
{
use MerSubBaseTrait;
#[ORM\Column(type: 'integer', nullable: true)]
private $pin;
public function getPin(): ?int
{
return $this->pin;
}
public function setPin(?int $pin): self
{
$this->pin = $pin;
return $this;
}
}

View File

@ -1,57 +0,0 @@
<?php
namespace App\Entity;
use App\Repository\MerServiceRepository;
use Doctrine\ORM\Mapping as ORM;
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap([
'para_dm' => MerParaDM::class,
'para_dt' => MerParaDT::class,
'be_dm' => MerBeDM::class
])]
#[ORM\Entity(repositoryClass: MerServiceRepository::class)]
abstract class MerService
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'integer', nullable: true)]
private $mcc_mnc;
#[ORM\Column(type: 'json', nullable: true)]
private $metadata = [];
public function getId(): ?int
{
return $this->id;
}
public function getMccMnc(): ?int
{
return $this->mcc_mnc;
}
public function setMccMnc(?int $mcc_mnc): self
{
$this->mcc_mnc = $mcc_mnc;
return $this;
}
public function getMetadata(): ?array
{
return $this->metadata;
}
public function setMetadata(?array $metadata): self
{
$this->metadata = $metadata;
return $this;
}
}

View File

@ -1,80 +0,0 @@
<?php
namespace App\Entity;
use App\Enum\SubStatus;
use Doctrine\ORM\Mapping as ORM;
trait MerSubBaseTrait
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(enumType: SubStatus::class)]
private SubStatus $status;
#[ORM\ManyToOne(targetEntity: MerService::class)]
#[ORM\JoinColumn(nullable: false)]
private MerService $service;
#[ORM\Column(type: 'datetime_immutable')]
private $sub_date;
#[ORM\Column(type: 'datetime_immutable', nullable: true)]
private $unsub_date;
public function getId(): ?int
{
return $this->id;
}
public function getStatus(): SubStatus
{
return $this->status;
}
public function setStatus(SubStatus $status): self
{
$this->status = $status;
return $this;
}
public function getService(): ?MerService
{
return $this->service;
}
public function setService(?MerService $service): self
{
$this->service = $service;
return $this;
}
public function getSubDate(): ?\DateTimeImmutable
{
return $this->sub_date;
}
public function setSubDate(\DateTimeImmutable $subDate): self
{
$this->sub_date = $subDate;
return $this;
}
public function getUnsubDate(): ?\DateTimeImmutable
{
return $this->unsub_date;
}
public function setUnsubDate(?\DateTimeImmutable $unsubDate): self
{
$this->unsub_date = $unsubDate;
return $this;
}
}

View File

@ -1,75 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\MappedSuperclass]
class Person1
{
#[ORM\Column(type: 'integer')]
protected int $age;
#[ORM\Column(type: 'string')]
protected string $name;
#[ORM\OneToOne(targetEntity: 'Toothbrush1', cascade: ['persist'])]
#[ORM\JoinColumn(name: 'toothbrush1_id', referencedColumnName: 'id')]
protected Toothbrush1 $toothbrush;
/**
* @return int
*/
public function getAge(): int
{
return $this->age;
}
/**
* @param int $age
* @return Person1
*/
public function setAge(int $age): Person1
{
$this->age = $age;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return Person1
*/
public function setName(string $name): Person1
{
$this->name = $name;
return $this;
}
/**
* @return Toothbrush1
*/
public function getToothbrush(): Toothbrush1
{
return $this->toothbrush;
}
/**
* @param Toothbrush1 $toothbrush
* @return Person1
*/
public function setToothbrush(Toothbrush1 $toothbrush): Person1
{
$this->toothbrush = $toothbrush;
return $this;
}
}

View File

@ -1,101 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
#[ORM\InheritanceType('SINGLE_TABLE')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap(['person2' => 'Person2', 'employee2' => 'Employee2'])]
class Person2
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'integer')]
protected int $age;
#[ORM\Column(type: 'string')]
protected string $name;
#[ORM\OneToOne(targetEntity: 'Toothbrush2', cascade: ['persist'])]
#[ORM\JoinColumn(name: 'toothbrush2_id', referencedColumnName: 'id')]
protected Toothbrush2 $toothbrush;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Person2
*/
public function setId(int $id): Person2
{
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getAge(): int
{
return $this->age;
}
/**
* @param int $age
* @return Person2
*/
public function setAge(int $age): Person2
{
$this->age = $age;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return Person2
*/
public function setName(string $name): Person2
{
$this->name = $name;
return $this;
}
/**
* @return Toothbrush2
*/
public function getToothbrush(): Toothbrush2
{
return $this->toothbrush;
}
/**
* @param Toothbrush2 $toothbrush
* @return Person2
*/
public function setToothbrush(Toothbrush2 $toothbrush): Person2
{
$this->toothbrush = $toothbrush;
return $this;
}
}

View File

@ -1,101 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
#[ORM\InheritanceType('JOINED')]
#[ORM\DiscriminatorColumn(name: 'discr', type: 'string')]
#[ORM\DiscriminatorMap(['person3' => 'Person3', 'employee3' => 'Employee3'])]
class Person3
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'integer')]
protected int $age;
#[ORM\Column(type: 'string')]
protected string $name;
#[ORM\OneToOne(targetEntity: 'Toothbrush3', cascade: ['persist'])]
#[ORM\JoinColumn(name: 'toothbrush3_id', referencedColumnName: 'id')]
protected Toothbrush3 $toothbrush;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Person3
*/
public function setId(int $id): Person3
{
$this->id = $id;
return $this;
}
/**
* @return int
*/
public function getAge(): int
{
return $this->age;
}
/**
* @param int $age
* @return Person3
*/
public function setAge(int $age): Person3
{
$this->age = $age;
return $this;
}
/**
* @return string
*/
public function getName(): string
{
return $this->name;
}
/**
* @param string $name
* @return Person3
*/
public function setName(string $name): Person3
{
$this->name = $name;
return $this;
}
/**
* @return Toothbrush3
*/
public function getToothbrush(): Toothbrush3
{
return $this->toothbrush;
}
/**
* @param Toothbrush3 $toothbrush
* @return Person3
*/
public function setToothbrush(Toothbrush3 $toothbrush): Person3
{
$this->toothbrush = $toothbrush;
return $this;
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Toothbrush1
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $brand;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Toothbrush1
*/
public function setId(int $id): Toothbrush1
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getBrand(): string
{
return $this->brand;
}
/**
* @param string $brand
* @return Toothbrush1
*/
public function setBrand(string $brand): Toothbrush1
{
$this->brand = $brand;
return $this;
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Toothbrush2
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $brand;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Toothbrush2
*/
public function setId(int $id): Toothbrush2
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getBrand(): string
{
return $this->brand;
}
/**
* @param string $brand
* @return Toothbrush2
*/
public function setBrand(string $brand): Toothbrush2
{
$this->brand = $brand;
return $this;
}
}

View File

@ -1,54 +0,0 @@
<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
////#[ORM\Entity]
class Toothbrush3
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string')]
private string $brand;
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
* @return Toothbrush3
*/
public function setId(int $id): Toothbrush3
{
$this->id = $id;
return $this;
}
/**
* @return string
*/
public function getBrand(): string
{
return $this->brand;
}
/**
* @param string $brand
* @return Toothbrush3
*/
public function setBrand(string $brand): Toothbrush3
{
$this->brand = $brand;
return $this;
}
}

View File

@ -1,12 +0,0 @@
<?php
namespace App\Enum;
enum SubStatus: int
{
case PREREGISTERED = 1;
case REGISTERED = 2;
case ACTIVE = 3;
case CANCELLED = 4;
case EXPIRED = 5;
}

View File

@ -1,77 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\Entity1;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<Entity1>
*
* @method Entity1|null find($id, $lockMode = null, $lockVersion = null)
* @method Entity1|null findOneBy(array $criteria, array $orderBy = null)
* @method Entity1[] findAll()
* @method Entity1[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class Entity1Repository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Entity1::class);
}
public function add(Entity1 $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Entity1 $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return Entity1[] Returns an array of Entity1 objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('e')
// ->andWhere('e.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('e.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
public function findOneByName($value): ?Entity1
{
return $this->createQueryBuilder('e')
->andWhere('e.name = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
/**
* https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/schema-manager.html
*
* @return \Doctrine\DBAL\Schema\AbstractSchemaManager|null
* @throws \Doctrine\DBAL\Exception
*/
public function getSchemaManager()
{
return $this->getEntityManager()->getConnection()->getSchemaManager();
}
}

View File

@ -1,75 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerBeDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerBeDM>
* @method MerBeDM|null find($id, $lockMode = null, $lockVersion = null)
* @method MerBeDM|null findOneBy(array $criteria, array $orderBy = null)
* @method MerBeDM[] findAll()
* @method MerBeDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerBeDMRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerBeDM::class);
}
public function add(MerBeDM $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerBeDM $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerBeDM[] Returns an array of MerBeDM objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerBeDM
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
public function findByOfferId(int $offerId)
{
return $this->createQueryBuilder('s')
->andWhere('s.offer_id = :offer_id')
->setParameter('offer_id', $offerId)
->getQuery()
->getResult()
;
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerBeSub;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerBeSub>
*
* @method MerBeSub|null find($id, $lockMode = null, $lockVersion = null)
* @method MerBeSub|null findOneBy(array $criteria, array $orderBy = null)
* @method MerBeSub[] findAll()
* @method MerBeSub[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerBeSubRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerBeSub::class);
}
public function add(MerBeSub $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerBeSub $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerBeSub[] Returns an array of MerBeSub objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
public function findOne(): ?MerBeSub
{
return $this->createQueryBuilder('m')
->orderBy('m.id', 'ASC')
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
}
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerDM>
* @method MerDM|null find($id, $lockMode = null, $lockVersion = null)
* @method MerDM|null findOneBy(array $criteria, array $orderBy = null)
* @method MerDM[] findAll()
* @method MerDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerDMRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerDM::class);
}
public function add(MerDM $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerDM $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerDM[] Returns an array of MerDM objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerDM
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerDT;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerDT>
* @method MerDT|null find($id, $lockMode = null, $lockVersion = null)
* @method MerDT|null findOneBy(array $criteria, array $orderBy = null)
* @method MerDT[] findAll()
* @method MerDT[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerDTRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerDT::class);
}
public function add(MerDT $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerDT $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerDT[] Returns an array of MerDT objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerDT
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerParaDM;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaDM>
* @method MerParaDM|null find($id, $lockMode = null, $lockVersion = null)
* @method MerParaDM|null findOneBy(array $criteria, array $orderBy = null)
* @method MerParaDM[] findAll()
* @method MerParaDM[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerParaDMRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerParaDM::class);
}
public function add(MerParaDM $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerParaDM $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerParaDM[] Returns an array of MerParaDM objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerParaDM
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,65 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerParaDT;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaDT>
* @method MerParaDT|null find($id, $lockMode = null, $lockVersion = null)
* @method MerParaDT|null findOneBy(array $criteria, array $orderBy = null)
* @method MerParaDT[] findAll()
* @method MerParaDT[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerParaDTRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerParaDT::class);
}
public function add(MerParaDT $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerParaDT $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerParaDT[] Returns an array of MerParaDT objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerParaDT
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
}

View File

@ -1,76 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerParaSub;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerParaSub>
*
* @method MerParaSub|null find($id, $lockMode = null, $lockVersion = null)
* @method MerParaSub|null findOneBy(array $criteria, array $orderBy = null)
* @method MerParaSub[] findAll()
* @method MerParaSub[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerParaSubRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerParaSub::class);
}
public function add(MerParaSub $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerParaSub $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerParaSub[] Returns an array of MerParaSub objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
public function findOneById(int $id): ?MerParaSub
{
return $this->createQueryBuilder('m')
->andWhere('m.id = :val')
->setParameter('val', $id)
->getQuery()
->getOneOrNullResult()
;
}
public function findOne(): ?MerParaSub
{
return $this->createQueryBuilder('m')
->orderBy('m.id', 'ASC')
->setMaxResults(1)
->getQuery()
->getOneOrNullResult()
;
}
}

View File

@ -1,101 +0,0 @@
<?php
namespace App\Repository;
use App\Entity\MerService;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\ResultSetMapping;
use Doctrine\Persistence\ManagerRegistry;
/**
* @extends ServiceEntityRepository<MerService>
* @method MerService|null find($id, $lockMode = null, $lockVersion = null)
* @method MerService|null findOneBy(array $criteria, array $orderBy = null)
* @method MerService[] findAll()
* @method MerService[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class MerServiceRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, MerService::class);
}
public function add(MerService $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(MerService $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
// /**
// * @return MerService[] Returns an array of MerService objects
// */
// public function findByExampleField($value): array
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->orderBy('m.id', 'ASC')
// ->setMaxResults(10)
// ->getQuery()
// ->getResult()
// ;
// }
// public function findOneBySomeField($value): ?MerService
// {
// return $this->createQueryBuilder('m')
// ->andWhere('m.exampleField = :val')
// ->setParameter('val', $value)
// ->getQuery()
// ->getOneOrNullResult()
// ;
// }
/*
* offer_id is in MerDM, a trait used by MerParaDM for example.
* This field can't be used in MerService, so the idea is to do
* a partial load, and then refresh() the object to get all the
* fields.
*/
public function findByOfferId(int $offerId)
{
// return $this->createQueryBuilder('s')
// ->andWhere('s.offer_id = :offer_id')
// ->setParameter('offer_id', $offerId)
// ->getQuery()
// ->getResult()
// ;
$rsm = new ResultSetMapping();
$rsm->addEntityResult($this->getClassName(), 's');
$rsm->addFieldResult('s', 'id', 'id');
$rsm->addMetaResult('s', 'discr', '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;
}
}

View File

@ -1,38 +1,11 @@
{
"doctrine/annotations": {
"version": "1.13",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.10",
"ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05"
}
},
"doctrine/cache": {
"version": "2.2.0"
},
"doctrine/collections": {
"version": "1.6.8"
},
"doctrine/common": {
"version": "3.3.0"
},
"doctrine/data-fixtures": {
"version": "1.5.3"
},
"doctrine/dbal": {
"version": "3.3.6"
},
"doctrine/deprecations": {
"version": "v1.0.0"
},
"doctrine/doctrine-bundle": {
"version": "2.6",
"version": "2.10",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.4",
"ref": "ddddd8249dd55bbda16fa7a45bb7499ef6f8e90e"
"version": "2.10",
"ref": "e025a6cb69b195970543820b2f18ad21724473fa"
},
"files": [
"config/packages/doctrine.yaml",
@ -40,90 +13,35 @@
"src/Repository/.gitignore"
]
},
"doctrine/doctrine-fixtures-bundle": {
"version": "3.4",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.0",
"ref": "1f5514cfa15b947298df4d771e694e578d4c204d"
},
"files": [
"src/DataFixtures/AppFixtures.php"
]
},
"doctrine/doctrine-migrations-bundle": {
"version": "3.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "3.1",
"ref": "ee609429c9ee23e22d6fa5728211768f51ed2818"
"ref": "1d01ec03c6ecbd67c3375c5478c9a423ae5d6a33"
},
"files": [
"config/packages/doctrine_migrations.yaml",
"migrations/.gitignore"
]
},
"doctrine/event-manager": {
"version": "1.1.1"
},
"doctrine/inflector": {
"version": "2.0.4"
},
"doctrine/instantiator": {
"version": "1.4.1"
},
"doctrine/lexer": {
"version": "1.2.3"
},
"doctrine/migrations": {
"version": "3.5.1"
},
"doctrine/orm": {
"version": "2.12.2"
},
"doctrine/persistence": {
"version": "3.0.2"
},
"doctrine/sql-formatter": {
"version": "1.1.2"
},
"friendsofphp/proxy-manager-lts": {
"version": "v1.0.12"
},
"laminas/laminas-code": {
"version": "4.5.1"
},
"monolog/monolog": {
"version": "2.6.0"
},
"nikic/php-parser": {
"version": "v4.13.2"
},
"psr/cache": {
"version": "3.0.0"
},
"psr/container": {
"version": "2.0.2"
},
"psr/event-dispatcher": {
"version": "1.0.0"
},
"psr/log": {
"version": "3.0.0"
},
"symfony/cache": {
"version": "v6.0.8"
},
"symfony/cache-contracts": {
"version": "v3.0.1"
},
"symfony/config": {
"version": "v6.0.8"
"phpunit/phpunit": {
"version": "9.6",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "9.6",
"ref": "7364a21d87e658eb363c5020c072ecfdc12e2326"
},
"files": [
".env.test",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"symfony/console": {
"version": "6.0",
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
@ -135,7 +53,7 @@
]
},
"symfony/debug-bundle": {
"version": "6.0",
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
@ -146,52 +64,25 @@
"config/packages/debug.yaml"
]
},
"symfony/dependency-injection": {
"version": "v6.0.8"
},
"symfony/deprecation-contracts": {
"version": "v3.0.1"
},
"symfony/doctrine-bridge": {
"version": "v6.0.8"
},
"symfony/dotenv": {
"version": "v6.0.5"
},
"symfony/error-handler": {
"version": "v6.0.8"
},
"symfony/event-dispatcher": {
"version": "v6.0.3"
},
"symfony/event-dispatcher-contracts": {
"version": "v3.0.1"
},
"symfony/filesystem": {
"version": "v6.0.7"
},
"symfony/finder": {
"version": "v6.0.8"
},
"symfony/flex": {
"version": "2.1",
"version": "2.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "c0eeb50665f0f77226616b6038a9b06c03752d8e"
"ref": "146251ae39e06a95be0fe3d13c807bcf3938b172"
},
"files": [
".env"
]
},
"symfony/framework-bundle": {
"version": "6.0",
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.4",
"ref": "3cd216a4d007b78d8554d44a5b1c0a446dab24fb"
"version": "6.2",
"ref": "af47254c5e4cd543e6af3e4508298ffebbdaddd3"
},
"files": [
"config/packages/cache.yaml",
@ -204,14 +95,20 @@
"src/Kernel.php"
]
},
"symfony/http-foundation": {
"version": "v6.0.8"
},
"symfony/http-kernel": {
"version": "v6.0.8"
"symfony/mailer": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "4.3",
"ref": "2bf89438209656b85b9a49238c4467bff1b1f939"
},
"files": [
"config/packages/mailer.yaml"
]
},
"symfony/maker-bundle": {
"version": "1.43",
"version": "1.51",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
@ -219,8 +116,17 @@
"ref": "fadbfe33303a76e25cb63401050439aa9b1a9c7f"
}
},
"symfony/monolog-bridge": {
"version": "v6.0.3"
"symfony/messenger": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.0",
"ref": "ba1ac4e919baba5644d31b57a3284d6ba12d52ee"
},
"files": [
"config/packages/messenger.yaml"
]
},
"symfony/monolog-bundle": {
"version": "3.8",
@ -234,88 +140,138 @@
"config/packages/monolog.yaml"
]
},
"symfony/polyfill-intl-grapheme": {
"version": "v1.25.0"
},
"symfony/polyfill-intl-normalizer": {
"version": "v1.25.0"
},
"symfony/polyfill-mbstring": {
"version": "v1.25.0"
},
"symfony/polyfill-php81": {
"version": "v1.25.0"
},
"symfony/proxy-manager-bridge": {
"version": "v6.0.6"
},
"symfony/routing": {
"version": "6.0",
"symfony/notifier": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.0",
"ref": "eb3b377a4dc07006c4bdb2c773652cc9434f5246"
"version": "5.0",
"ref": "178877daf79d2dbd62129dd03612cb1a2cb407cc"
},
"files": [
"config/packages/notifier.yaml"
]
},
"symfony/phpunit-bridge": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "01dfaa98c58f7a7b5a9b30e6edb7074af7ed9819"
},
"files": [
".env.test",
"bin/phpunit",
"phpunit.xml.dist",
"tests/bootstrap.php"
]
},
"symfony/routing": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.2",
"ref": "e0a11b4ccb8c9e70b574ff5ad3dfdcd41dec5aa6"
},
"files": [
"config/packages/routing.yaml",
"config/routes.yaml"
]
},
"symfony/runtime": {
"version": "v6.0.8"
},
"symfony/service-contracts": {
"version": "v3.0.1"
},
"symfony/stopwatch": {
"version": "v6.0.5"
},
"symfony/string": {
"version": "v6.0.8"
},
"symfony/translation-contracts": {
"version": "v3.0.1"
},
"symfony/twig-bridge": {
"version": "v6.0.8"
},
"symfony/twig-bundle": {
"version": "6.0",
"symfony/security-bundle": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.4",
"ref": "bb2178c57eee79e6be0b297aa96fc0c0def81387"
"version": "6.0",
"ref": "8a5b112826f7d3d5b07027f93786ae11a1c7de48"
},
"files": [
"config/packages/security.yaml"
]
},
"symfony/translation": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "64fe617084223633e1dedf9112935d8c95410d3e"
},
"files": [
"config/packages/translation.yaml",
"translations/.gitignore"
]
},
"symfony/twig-bundle": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.3",
"ref": "b7772eb20e92f3fb4d4fe756e7505b4ba2ca1a2c"
},
"files": [
"config/packages/twig.yaml",
"templates/base.html.twig"
]
},
"symfony/var-dumper": {
"version": "v6.0.8"
},
"symfony/var-exporter": {
"version": "v6.0.8"
},
"symfony/web-profiler-bundle": {
"version": "6.0",
"symfony/validator": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "5.3",
"ref": "24bbc3d84ef2f427f82104f766014e799eefcc3e"
"ref": "c32cfd98f714894c4f128bb99aa2530c1227603c"
},
"files": [
"config/packages/validator.yaml"
]
},
"symfony/web-profiler-bundle": {
"version": "6.3",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "6.1",
"ref": "e42b3f0177df239add25373083a564e5ead4e13a"
},
"files": [
"config/packages/web_profiler.yaml",
"config/routes/web_profiler.yaml"
]
},
"symfony/yaml": {
"version": "v6.0.3"
"symfony/webapp-pack": {
"version": "1.2",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "aece95c8a188f6e6d04f01ccb8678d1764fd2642"
},
"files": [
"config/packages/messenger.yaml"
]
},
"twig/twig": {
"version": "v3.4.1"
"symfony/webpack-encore-bundle": {
"version": "2.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "2.0",
"ref": "082d754b3bd54b3fc669f278f1eea955cfd23cf5"
},
"files": [
"assets/app.js",
"assets/styles/app.css",
"config/packages/webpack_encore.yaml",
"package.json",
"webpack.config.js"
]
},
"twig/extra-bundle": {
"version": "v3.7.1"
}
}

View File

@ -3,18 +3,9 @@
<head>
<meta charset="UTF-8">
<title>{% block title %}Welcome!{% endblock %}</title>
{# <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">#}
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
{% block stylesheets %}
{{ encore_entry_link_tags('app') }}
<style>
body {
background-color: black;
color: white;
font-family: monospace;
}
</style>
{% endblock %}
{% block javascripts %}

View File

@ -0,0 +1,20 @@
{% extends 'base.html.twig' %}
{% block title %}Hello HomeController!{% endblock %}
{% block body %}
<style>
.example-wrapper { margin: 1em auto; max-width: 800px; width: 95%; font: 18px/1.5 sans-serif; }
.example-wrapper code { background: #F5F5F5; padding: 2px 6px; }
</style>
<div class="example-wrapper">
<h1>Hello {{ controller_name }}! ✅</h1>
This friendly message is coming from:
<ul>
<li>Your controller at <code><a href="{{ '/home/salvarez/dev/symfony-darkplan/src/Controller/HomeController.php'|file_link(0) }}">src/Controller/HomeController.php</a></code></li>
<li>Your template at <code><a href="{{ '/home/salvarez/dev/symfony-darkplan/templates/home/index.html.twig'|file_link(0) }}">templates/home/index.html.twig</a></code></li>
</ul>
</div>
{% endblock %}

View File

@ -1,37 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}Hello IndexController!{% endblock %}
{% block body %}
<ul>
{% for table in schemaManager.listTables %}
<li>
{{ table.name }}
<ul>
{% for column in schemaManager.listTableColumns(table.name) %}
<li>{{ column.name }} ({{ column.type.name }})</li>
{% endfor %}
<li>FK
<ul>
{% for fk in schemaManager.listTableForeignKeys(table.name) %}
<li>{{ fk.name ?? '??' }} ({{ fk.columns|join }}) -&gt; {{ fk.getForeignTableName() }}({{ fk.getForeignColumns()|join }})</li>
{% endfor %}
</ul>
</li>
<li>IX
<ul>
{% for fk in schemaManager.listTableIndexes(table.name) %}
<li>{{ fk.name }} ({{ fk.columns|join }})</li>
{% endfor %}
</ul>
</li>
</ul>
</li>
{% endfor %}
</ul>
<p><a href="{{ path('notification_dm', {'offer_id': 112}) }}">dm notification</a></p>
{% endblock %}

View File

@ -1,13 +0,0 @@
{% extends 'base.html.twig' %}
{% block title %}notif dm!{% endblock %}
{% block body %}
<p>check profiler output</p>
<h1>MerServiceRepository->findByOfferId</h1>
{{ dump(serviceRepo) }}
<h1>MerBeDMRepository->findByOfferId</h1>
{{ dump(beDmRepo) }}
{% endblock %}

11
tests/bootstrap.php Normal file
View File

@ -0,0 +1,11 @@
<?php
use Symfony\Component\Dotenv\Dotenv;
require dirname(__DIR__).'/vendor/autoload.php';
if (file_exists(dirname(__DIR__).'/config/bootstrap.php')) {
require dirname(__DIR__).'/config/bootstrap.php';
} elseif (method_exists(Dotenv::class, 'bootEnv')) {
(new Dotenv())->bootEnv(dirname(__DIR__).'/.env');
}

0
translations/.gitignore vendored Normal file
View File

83
webpack.config.js Normal file
View File

@ -0,0 +1,83 @@
const Encore = require('@symfony/webpack-encore');
// Manually configure the runtime environment if not already configured yet by the "encore" command.
// It's useful when you use tools that rely on webpack.config.js file.
if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}
Encore
// directory where compiled assets will be stored
.setOutputPath('public/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
// only needed for CDN's or subdirectory deploy
//.setManifestKeyPrefix('build/')
/*
* ENTRY CONFIG
*
* Each entry will result in one JavaScript file (e.g. app.js)
* and one CSS file (e.g. app.css) if your JavaScript imports CSS.
*/
.addEntry('app', './assets/app.js')
// When enabled, Webpack "splits" your files into smaller pieces for greater optimization.
.splitEntryChunks()
// will require an extra script tag for runtime.js
// but, you probably want this, unless you're building a single-page app
.enableSingleRuntimeChunk()
/*
* FEATURE CONFIG
*
* Enable & configure other features below. For a full
* list of features, see:
* https://symfony.com/doc/current/frontend.html#adding-more-features
*/
.cleanupOutputBeforeBuild()
.enableBuildNotifications()
.enableSourceMaps(!Encore.isProduction())
// enables hashed filenames (e.g. app.abc123.css)
.enableVersioning(Encore.isProduction())
// configure Babel
// .configureBabel((config) => {
// config.plugins.push('@babel/a-babel-plugin');
// })
// enables and configure @babel/preset-env polyfills
.configureBabelPresetEnv((config) => {
config.useBuiltIns = 'usage';
config.corejs = '3.23';
})
// enables Sass/SCSS support
.enableSassLoader()
// uncomment if you use TypeScript
//.enableTypeScriptLoader()
// uncomment if you use React
//.enableReactPreset()
// uncomment to get integrity="..." attributes on your script & link tags
// requires WebpackEncoreBundle 1.4 or higher
.enableIntegrityHashes(Encore.isProduction())
// uncomment if you're having problems with a jQuery plugin
.autoProvidejQuery()
.configureDevServerOptions(options => {
options.liveReload = true;
options.static = {
watch: false
};
options.watchFiles = {
paths: ['src/**/*.php', 'templates/**/*'],
};
})
;
module.exports = Encore.getWebpackConfig();

4403
yarn.lock Normal file

File diff suppressed because it is too large Load Diff