Skip to content

Commit

Permalink
Merge pull request #5353 from nanasess/improve/symfony5
Browse files Browse the repository at this point in the history
Symfony5 support
  • Loading branch information
chihiro-adachi authored Jun 2, 2022
2 parents 9b2f5f5 + 82705b6 commit 821502b
Show file tree
Hide file tree
Showing 471 changed files with 5,952 additions and 5,491 deletions.
12 changes: 4 additions & 8 deletions .env.dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ DATABASE_URL=sqlite:///var/eccube.db
DATABASE_SERVER_VERSION=3
###< doctrine/doctrine-bundle ###

###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# For a debug SMTP server, use: "smtp://mailcatcher:1025"
# Delivery is disabled by default via "null://localhost"
MAILER_URL=null://localhost
###< symfony/swiftmailer-bundle ###
###> symfony/mailer ###
MAILER_DSN=null://null
###< symfony/mailer ###

###> APPLICATION CONFIG ###
# EC-CUBE Configs. The default value is defined in app/config/packages/eccube.yaml.
Expand All @@ -55,4 +51,4 @@ MAILER_URL=null://localhost
#ECCUBE_2FA_COOKIE_NAME=eccube_2fa
#ECCUBE_2FA_EXPIRE=14

###< APPLICATION CONFIG ###
###< APPLICATION CONFIG ###
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
bin/console eccube:composer:require "ec-cube/gmc"
- name: revert to config platform.php
run: composer config platform.php 7.3.0
run: composer config platform.php 7.4.0

- name: Pre Install Plugins
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ jobs:
APP_ENV: 'codeception'
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_URL: 'smtp://127.0.0.1:1025'
MAILER_DSN: 'smtp://127.0.0.1:1025'
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
run: php -S 127.0.0.1:8000 codeception/router.php &

Expand All @@ -119,7 +119,7 @@ jobs:
APP_ENV: ${{ matrix.app_env }}
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_URL: 'smtp://127.0.0.1:1025'
MAILER_DSN: 'smtp://127.0.0.1:1025'
ECCUBE_PACKAGE_API_URL: 'http://127.0.0.1:8080'
GROUP: ${{ matrix.group }}
SYMFONY_DEPRECATIONS_HELPER: weak
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@ jobs:
if [[ ! -d ${PWD}/repos ]]; then mkdir -p ${PWD}/repos ; fi
docker run -d --rm -v ${PWD}/repos:/repos -e MOCK_REPO_DIR=/repos -p 8080:8080 eccube/mock-package-api:composer2
## XXX Symfony5.4 に対応するためには trikoder/oauth2-bundle "v3.x-dev@dev" に依存する必要がある
## XXX 依存する Bundle を先に require して, Symfony Flex が Bundle を二重定義してしまう問題を回避する
- run: |
sed -e 's/"minimum-stability": "stable",/"minimum-stability": "dev",/g' -i composer.json
composer require nyholm/psr7 "^1.5"
composer require ajgarlag/psr-http-message-bundle "^1.2"
- name: Codeception
env:
APP_ENV: ${{ matrix.app_env }}
Expand Down
27 changes: 25 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
operating-system: [ ubuntu-18.04 ]
php: [ '7.3', '7.4' ]
php: [ '7.4', '8.0', '8.1' ]
db: [ mysql, pgsql, sqlite3 ]
include:
- db: mysql
Expand Down Expand Up @@ -76,21 +76,28 @@ jobs:

- name: Setup EC-CUBE
env:
APP_ENV: 'test'
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
run: |
bin/console doctrine:database:create
bin/console doctrine:schema:create
bin/console eccube:fixtures:load
- name: PHPUnit
env:
APP_ENV: 'test'
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_URL: 'smtp://127.0.0.11025'
run: bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine,plugin-service
- name: PHPUnit
env:
APP_ENV: 'test'
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_URL: 'smtp://127.0.0.11025'
run: |
bin/phpunit --exclude-group cache-clear,cache-clear-install,update-schema-doctrine
bin/phpunit --group cache-clear
bin/phpunit --group cache-clear-install
bin/phpunit --group update-schema-doctrine --exclude-group update-schema-doctrine-install
Expand All @@ -101,3 +108,19 @@ jobs:
bin/phpunit --group update-schema-doctrine-install --filter=testDisablePluginWithNoProxy
bin/phpunit --group update-schema-doctrine-install --filter=testDisablePluginWithProxy
bin/phpunit --group update-schema-doctrine-install --filter=testCreateEntityAndTrait
## XXX MySQL で Syntax error or access violation: 1305 SAVEPOINT DOCTRINE2_SAVEPOINT_3 does not exist が
## 発生するため \DAMA\DoctrineTestBundle\PHPUnit\PHPUnitListener を削除する
## see https://github.com/dmaicher/doctrine-test-bundle/issues/58#issuecomment-391081408
- run: sed -e '/DoctrineTestBundle/d' phpunit.xml.dist > phpunit.xml
if: ${{ matrix.db == 'mysql' }}
- name: PHPUnit
env:
APP_ENV: 'test'
DATABASE_URL: ${{ matrix.database_url }}
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }}
MAILER_URL: 'smtp://127.0.0.11025'
run: |
rm -r app/Plugin/*
git checkout app/Plugin
rm -r var/cache
bin/phpunit --group plugin-service
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,3 @@ node_modules
.php_cs
.php_cs.cache
###< friendsofphp/php-cs-fixer ###

###> symfony/web-server-bundle ###
.web-server-pid
###< symfony/web-server-bundle ###
2 changes: 1 addition & 1 deletion app/DoctrineMigrations/Version20190821081036.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function up(Schema $schema): void
return;
}

$taxRateExists = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_csv WHERE csv_type_id = 1 AND entity_name = ? AND field_name = 'TaxRule' AND reference_field_name = 'tax_rate'", ['Eccube\\\\Entity\\\\ProductClass']);
$taxRateExists = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_csv WHERE csv_type_id = 1 AND entity_name = ? AND field_name = 'TaxRule' AND reference_field_name = 'tax_rate'", ['Eccube\\\\Entity\\\\ProductClass']);
if ($taxRateExists == 0) {
$this->addSql("INSERT INTO dtb_csv (csv_type_id, creator_id, entity_name, field_name, reference_field_name, disp_name, sort_no, enabled, create_date, update_date, discriminator_type) VALUES (1, null , ?, 'TaxRule', 'tax_rate', '税率', 31, false, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP,'csv')", ['Eccube\\\\Entity\\\\ProductClass']);
}
Expand Down
6 changes: 3 additions & 3 deletions app/DoctrineMigrations/Version20201127000000.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ final class Version20201127000000 extends AbstractMigration
{
public function up(Schema $schema): void
{
$count = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_page WHERE url = 'entry_confirm'");
$count = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_page WHERE url = 'entry_confirm'");
if ($count > 0) {
return;
}
$pageId = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_page');
$sortNo = $this->connection->fetchColumn('SELECT MAX(sort_no) FROM dtb_page_layout');
$pageId = $this->connection->fetchOne('SELECT MAX(id) FROM dtb_page');
$sortNo = $this->connection->fetchOne('SELECT MAX(sort_no) FROM dtb_page_layout');

$pageId++;
$this->addSql("INSERT INTO dtb_page (
Expand Down
4 changes: 2 additions & 2 deletions app/DoctrineMigrations/Version20201218044542.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ final class Version20201218044542 extends AbstractMigration
{
public function up(Schema $schema): void
{
$pointExists = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_csv WHERE csv_type_id = 2 AND field_name = 'point'");
$pointExists = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_csv WHERE csv_type_id = 2 AND field_name = 'point'");

if ($pointExists == 0) {
$sortNo = $this->connection->fetchColumn('SELECT MAX(sort_no) + 1 FROM dtb_csv WHERE csv_type_id = 2');
$sortNo = $this->connection->fetchOne('SELECT MAX(sort_no) + 1 FROM dtb_csv WHERE csv_type_id = 2');
$this->addSql("INSERT INTO dtb_csv (
csv_type_id, creator_id, entity_name, field_name, disp_name, sort_no, enabled, create_date, update_date, discriminator_type
) VALUES (
Expand Down
4 changes: 2 additions & 2 deletions app/DoctrineMigrations/Version20210316120000.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ final class Version20210316120000 extends AbstractMigration
public function up(Schema $schema): void
{
// データ存在チェック
$count = $this->connection->fetchColumn("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'カレンダー'");
$count = $this->connection->fetchOne("SELECT COUNT(*) FROM dtb_block WHERE block_name = 'カレンダー'");
if ($count > 0) {
return;
}

// idを取得する
$id = $this->connection->fetchColumn('SELECT MAX(id) FROM dtb_block');
$id = $this->connection->fetchOne('SELECT MAX(id) FROM dtb_block');
$id++;

$this->addSql("INSERT INTO dtb_block (id, block_name, file_name, use_controller, deletable, create_date, update_date, device_type_id, discriminator_type) VALUES ($id, 'カレンダー', 'calendar', true, false, '2021-03-16 12:00:00', '2021-03-16 12:00:00', 10, 'block')");
Expand Down
6 changes: 3 additions & 3 deletions app/DoctrineMigrations/Version20210319122142.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ public function up(Schema $schema): void
LoginHistoryStatus::SUCCESS => $lang === 'en' ? 'Success' : '成功',
];

$sortNo = $this->connection->fetchColumn('SELECT MAX(sort_no) + 1 FROM mtb_login_history_status');
$sortNo = $this->connection->fetchOne('SELECT MAX(sort_no) + 1 FROM mtb_login_history_status');
if (is_null($sortNo)) {
$sortNo = 0;
}

foreach ($statuses as $id => $name) {
$statusExists = $this->connection->fetchColumn(
$statusExists = $this->connection->fetchOne(
'SELECT COUNT(*) FROM mtb_login_history_status WHERE id = :id',
[':id' => $id]
['id' => $id]
);

if ($statusExists == 0) {
Expand Down
2 changes: 1 addition & 1 deletion app/DoctrineMigrations/Version20210412073123.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class Version20210412073123 extends AbstractMigration
public function up(Schema $schema): void
{
if ($schema->hasTable('plg_admin_record_config')) {
$denyHostsPlugin = $this->connection->fetchColumn('select admin_deny_hosts FROM plg_admin_record_config') ?: '';
$denyHostsPlugin = $this->connection->fetchOne('select admin_deny_hosts FROM plg_admin_record_config') ?: '';
$denyHostsPlugin = array_filter(\explode("\n", StringUtil::convertLineFeed($denyHostsPlugin)), function ($str) {
return StringUtil::isNotBlank($str);
});
Expand Down
9 changes: 3 additions & 6 deletions app/config/eccube/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,17 @@
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['all' => true],
Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle::class => ['all' => true],
Symfony\Bundle\MonologBundle\MonologBundle::class => ['all' => true],
Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Symfony\Bundle\DebugBundle\DebugBundle::class => ['dev' => true, 'test' => true, 'install' => true],
Symfony\Bundle\WebServerBundle\WebServerBundle::class => ['dev' => true, 'install' => true],
Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true, 'install' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
SunCat\MobileDetectBundle\MobileDetectBundle::class => ['all' => true],
Knp\Bundle\PaginatorBundle\KnpPaginatorBundle::class => ['all' => true],
Exercise\HTMLPurifierBundle\ExerciseHTMLPurifierBundle::class => ['all' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
DAMA\DoctrineTestBundle\DAMADoctrineTestBundle::class => ['test' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
];
2 changes: 1 addition & 1 deletion app/config/eccube/packages/dev/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# https://symfony.com/doc/master/bundles/DoctrineBundle/configuration.html
doctrine:
orm:
result_cache_driver: array
result_cache_driver: ~
4 changes: 0 additions & 4 deletions app/config/eccube/packages/dev/swiftmailer.yaml

This file was deleted.

8 changes: 5 additions & 3 deletions app/config/eccube/packages/doctrine_migrations.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
doctrine_migrations:
dir_name: "%kernel.project_dir%/app/DoctrineMigrations"
namespace: DoctrineMigrations
organize_migrations: false
migrations_paths:
# namespace is arbitrary but should be different from App\Migrations
# as migrations classes should NOT be autoloaded
'DoctrineMigrations': '%kernel.project_dir%/app/DoctrineMigrations'
enable_profiler: '%kernel.debug%'
12 changes: 6 additions & 6 deletions app/config/eccube/packages/eccube.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ parameters:
env(ECCUBE_USER_DATA_ROUTE): 'user_data'
env(ECCUBE_ADMIN_ALLOW_HOSTS): '[]'
env(ECCUBE_ADMIN_DENY_HOSTS): '[]'
env(ECCUBE_FORCE_SSL): false
env(ECCUBE_FORCE_SSL): '0'
env(ECCUBE_TEMPLATE_CODE): 'default'
env(ECCUBE_AUTH_MAGIC): '<change.me>'
env(ECCUBE_COOKIE_NAME): 'eccube'
env(ECCUBE_COOKIE_PATH): '/'
env(ECCUBE_COOKIE_LIFETIME): 0
env(ECCUBE_GC_MAXLIFETIME): 1440
env(ECCUBE_COOKIE_LIFETIME): '0'
env(ECCUBE_GC_MAXLIFETIME): '1440'
env(ECCUBE_PACKAGE_API_URL): 'https://package-api-c2.ec-cube.net'
env(ECCUBE_OWNERS_STORE_URL): 'https://www.ec-cube.net'
env(ECCUBE_MAINTENANCE_FILE_PATH): '%kernel.project_dir%/.maintenance'
env(ECCUBE_2FA_ENABLED): true
env(ECCUBE_2FA_ENABLED): '1'
env(ECCUBE_2FA_COOKIE_NAME): 'eccube_2fa'
env(ECCUBE_2FA_EXPIRE): 14
env(ECCUBE_2FA_EXPIRE): '14'

# EC-CUBE parameter
eccube_database_url: '%env(DATABASE_URL)%'
eccube_mailer_url: '%env(MAILER_URL)%'
eccube_mailer_dsn: '%env(MAILER_DSN)%'
eccube_admin_route: '%env(ECCUBE_ADMIN_ROUTE)%'
eccube_user_data_route: '%env(ECCUBE_USER_DATA_ROUTE)%'
eccube_admin_allow_hosts: '%env(json:ECCUBE_ADMIN_ALLOW_HOSTS)%'
Expand Down
2 changes: 1 addition & 1 deletion app/config/eccube/packages/framework.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ framework:
# See https://symfony.com/doc/current/reference/configuration/framework.html#ide
ide: ~
validation: { enable_annotations: true }
templating: { engines: ['twig'] }
# templating: { engines: ['twig'] }
5 changes: 5 additions & 0 deletions app/config/eccube/packages/mailer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
parameters:
env(MAILER_DSN): ''
framework:
mailer:
dsn: '%env(MAILER_DSN)%'
5 changes: 2 additions & 3 deletions app/config/eccube/packages/order_state_machine.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
'order' => [
'type' => 'state_machine',
'marking_store' => [
'type' => 'single_state',
'arguments' => 'status',
'type' => 'method'
],
'supports' => [
OrderStateMachineContext::class,
],
'initial_place' => (string) Status::NEW,
'initial_marking' => (string) Status::NEW,
'places' => [
(string) Status::NEW,
(string) Status::CANCEL,
Expand Down
5 changes: 0 additions & 5 deletions app/config/eccube/packages/swiftmailer.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion app/config/eccube/packages/test/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# https://symfony.com/doc/master/bundles/DoctrineBundle/configuration.html
doctrine:
orm:
result_cache_driver: array
result_cache_driver: ~
2 changes: 0 additions & 2 deletions app/config/eccube/packages/test/swiftmailer.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion app/config/eccube/packages/twig_extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ services:

#Twig\Extensions\ArrayExtension: ~
#Twig\Extensions\DateExtension: ~
Twig\Extensions\IntlExtension: ~
# Twig\Extensions\IntlExtension: ~
#Twig\Extensions\TextExtension: ~
4 changes: 2 additions & 2 deletions app/config/eccube/routes.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
controllers:
resource: ../../src/Eccube/Controller/
resource: ../../../src/Eccube/Controller
type: annotation
customize_controllers:
resource: ../../app/Customize/Controller/
resource: ../../../app/Customize/Controller
type: annotation

# prefix: /{_locale}
Expand Down
6 changes: 3 additions & 3 deletions app/config/eccube/routes/dev/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
# _errors:
# resource: '@TwigBundle/Resources/config/routing/errors.xml'
# prefix: /_error
6 changes: 3 additions & 3 deletions app/config/eccube/routes/install/twig.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
# _errors:
# resource: '@TwigBundle/Resources/config/routing/errors.xml'
# prefix: /_error
4 changes: 2 additions & 2 deletions app/config/eccube/routes_install.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
controllers:
resource: ../../src/Eccube/Controller/Install/
type: annotation
resource: ../../../src/Eccube/Controller/Install/
type: annotation
Loading

0 comments on commit 821502b

Please sign in to comment.