From 6fc95673df5349d682eb6ca6185f894eb711d13a Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 24 Oct 2018 21:02:35 +0200 Subject: Cleanup --- app/AppKernel.php | 22 +++++++++++++++++++--- app/autoload.php | 13 ------------- 2 files changed, 19 insertions(+), 16 deletions(-) delete mode 100644 app/autoload.php (limited to 'app') diff --git a/app/AppKernel.php b/app/AppKernel.php index 546794de..7d19e9ab 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php @@ -1,6 +1,7 @@ getEnvironment()) { $bundles[] = new DAMA\DoctrineTestBundle\DAMADoctrineTestBundle(); } + + if ('dev' === $this->getEnvironment()) { + $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); + $bundles[] = new Symfony\Bundle\WebServerBundle\WebServerBundle(); + } } return $bundles; } + public function getRootDir() + { + return __DIR__; + } + public function getCacheDir() { return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); @@ -70,7 +79,8 @@ class AppKernel extends Kernel public function registerContainerConfiguration(LoaderInterface $loader) { - $loader->load($this->getProjectDir() . '/app/config/config_' . $this->getEnvironment() . '.yml'); + $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml'); + $loader->load(function ($container) { if ($container->getParameter('use_webpack_dev_server')) { $container->loadFromExtension('framework', [ @@ -86,5 +96,11 @@ class AppKernel extends Kernel ]); } }); + + $loader->load(function (ContainerBuilder $container) { + // $container->setParameter('container.autowiring.strict_mode', true); + // $container->setParameter('container.dumper.inline_class_loader', true); + $container->addObjectResource($this); + }); } } diff --git a/app/autoload.php b/app/autoload.php deleted file mode 100644 index c5f664dc..00000000 --- a/app/autoload.php +++ /dev/null @@ -1,13 +0,0 @@ - Date: Mon, 26 Nov 2018 20:00:01 +0100 Subject: Update fixtures --- app/config/services_test.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'app') diff --git a/app/config/services_test.yml b/app/config/services_test.yml index a300f75d..1b3aff63 100644 --- a/app/config/services_test.yml +++ b/app/config/services_test.yml @@ -22,17 +22,17 @@ services: - "%kernel.cache_dir%/doctrine/metadata" # fixtures - Wallabag\AnnotationBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/ORM/*' + Wallabag\UserBundle\DataFixtures\: + resource: '../../src/Wallabag/UserBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true - Wallabag\CoreBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/CoreBundle/DataFixtures/ORM/*' + Wallabag\CoreBundle\DataFixtures\: + resource: '../../src/Wallabag/CoreBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true - Wallabag\UserBundle\DataFixtures\ORM\: - resource: '../../src/Wallabag/UserBundle/DataFixtures/ORM/*' + Wallabag\AnnotationBundle\DataFixtures\: + resource: '../../src/Wallabag/AnnotationBundle/DataFixtures/*' tags: ['doctrine.fixture.orm'] autowire: true -- cgit v1.2.3 From 1b6b77f02956a767fb3fa9825a7b97b4879f7d42 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 26 Nov 2018 20:02:15 +0100 Subject: Remove custom Postgres class Because PG > 10 is now supported by DBAL >= 2.6.0 --- app/config/config.yml | 1 - app/config/config_test.yml | 1 - app/config/parameters.yml.dist | 2 -- app/config/parameters_test.yml | 1 - app/config/tests/parameters_test.mysql.yml | 1 - app/config/tests/parameters_test.pgsql.yml | 1 - app/config/tests/parameters_test.sqlite.yml | 1 - 7 files changed, 8 deletions(-) (limited to 'app') diff --git a/app/config/config.yml b/app/config/config.yml index 092f3ec0..ee0f0a38 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -46,7 +46,6 @@ twig: doctrine: dbal: driver: "%database_driver%" - driver_class: "%database_driver_class%" host: "%database_host%" port: "%database_port%" dbname: "%database_name%" diff --git a/app/config/config_test.yml b/app/config/config_test.yml index 11e0feb7..216f8431 100644 --- a/app/config/config_test.yml +++ b/app/config/config_test.yml @@ -24,7 +24,6 @@ swiftmailer: doctrine: dbal: driver: "%test_database_driver%" - driver_class: "%test_database_driver_class%" host: "%test_database_host%" port: "%test_database_port%" dbname: "%test_database_name%" diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index d21f20e0..13e2584f 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -11,8 +11,6 @@ parameters: # database_password: %env.database_password% database_driver: pdo_mysql - database_driver_class: ~ - # database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver database_host: 127.0.0.1 database_port: ~ database_name: wallabag diff --git a/app/config/parameters_test.yml b/app/config/parameters_test.yml index 64e51976..257d2ace 100644 --- a/app/config/parameters_test.yml +++ b/app/config/parameters_test.yml @@ -8,4 +8,3 @@ parameters: test_database_path: "%env(TEST_DATABASE_PATH)%" env(TEST_DATABASE_PATH): "%kernel.project_dir%/data/db/wallabag_test.sqlite" test_database_charset: utf8 - test_database_driver_class: ~ diff --git a/app/config/tests/parameters_test.mysql.yml b/app/config/tests/parameters_test.mysql.yml index 0b7b82eb..36b227fb 100644 --- a/app/config/tests/parameters_test.mysql.yml +++ b/app/config/tests/parameters_test.mysql.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_mysql - test_database_driver_class: ~ test_database_host: localhost test_database_port: 3306 test_database_name: wallabag_test diff --git a/app/config/tests/parameters_test.pgsql.yml b/app/config/tests/parameters_test.pgsql.yml index ea249324..60f51df6 100644 --- a/app/config/tests/parameters_test.pgsql.yml +++ b/app/config/tests/parameters_test.pgsql.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_pgsql - test_database_driver_class: Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver test_database_host: localhost test_database_port: test_database_name: wallabag_test diff --git a/app/config/tests/parameters_test.sqlite.yml b/app/config/tests/parameters_test.sqlite.yml index 64cd984b..2b92d579 100644 --- a/app/config/tests/parameters_test.sqlite.yml +++ b/app/config/tests/parameters_test.sqlite.yml @@ -1,6 +1,5 @@ parameters: test_database_driver: pdo_sqlite - test_database_driver_class: ~ test_database_host: localhost test_database_port: test_database_name: ~ -- cgit v1.2.3 From 877787e5fe6a6545105616968939949b4db81347 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Wed, 28 Nov 2018 20:26:18 +0100 Subject: Fix utf8mb4 on vendor tables When creating the schema for test these tables use default length for string: 255. Which fail when using utf8mb4. > Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes Also move the `setKeepStaticConnections` in before and after class to avoid: > SAVEPOINT DOCTRINE2_SAVEPOINT_2 does not exist See https://github.com/dmaicher/doctrine-test-bundle#troubleshooting --- app/DoctrineMigrations/Version20180405182455.php | 21 ++--------- app/DoctrineMigrations/Version20181128203230.php | 45 ++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 19 deletions(-) create mode 100644 app/DoctrineMigrations/Version20181128203230.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20180405182455.php b/app/DoctrineMigrations/Version20180405182455.php index 71879c0e..50fe97c7 100755 --- a/app/DoctrineMigrations/Version20180405182455.php +++ b/app/DoctrineMigrations/Version20180405182455.php @@ -2,26 +2,14 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add archived_at column and set its value to updated_at for is_archived entries. */ -class Version20180405182455 extends AbstractMigration implements ContainerAwareInterface +class Version20180405182455 extends WallabagMigration { - /** - * @var ContainerInterface - */ - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - /** * @param Schema $schema */ @@ -60,9 +48,4 @@ class Version20180405182455 extends AbstractMigration implements ContainerAwareI $entryTable->dropColumn('archived_at'); } - - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix') . $tableName; - } } diff --git a/app/DoctrineMigrations/Version20181128203230.php b/app/DoctrineMigrations/Version20181128203230.php new file mode 100644 index 00000000..d1b09fc7 --- /dev/null +++ b/app/DoctrineMigrations/Version20181128203230.php @@ -0,0 +1,45 @@ +skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(191) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(191)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(191)'); + } + + public function down(Schema $schema) + { + $this->skipIf('mysql' !== $this->connection->getDatabasePlatform()->getName(), 'This migration can only be applied on \'mysql\'.'); + + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_access_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_auth_codes') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `token` `token` varchar(255) NOT NULL'); + $this->addSql('ALTER TABLE ' . $this->getTable('oauth2_refresh_tokens') . ' CHANGE `scope` `scope` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `name` `name` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `section` `section` varchar(255)'); + $this->addSql('ALTER TABLE ' . $this->getTable('craue_config_setting') . ' CHANGE `value` `value` varchar(255)'); + } +} -- cgit v1.2.3