Skip to content

Symfony7適合 - #59

Open
KenTanaka wants to merge 16 commits into
EC-CUBE:4.4from
KenTanaka:feat-4.4
Open

KenTanaka wants to merge 16 commits into
EC-CUBE:4.4from
KenTanaka:feat-4.4

Conversation

@KenTanaka

Copy link
Copy Markdown
Collaborator

概要

会員向け2段階認証プラグインを EC-CUBE 4.4(Symfony 7.4 / Doctrine ORM 3.0 / PHP 8.2+) に対応させ、コードを TwoFactorAuthCustomer42 → TwoFactorAuthCustomer44 に改名します。4.3 とは非互換(属性必須・ORM 3・PHP 8.2+)のため、新規 4.4 ブランチへの取り込みです。

参考: 4.3→4.4 マイグレーション手順 (doc #346) / 参照 Recommend-plugin #67

変更内容

1. EC-CUBE 4.4 対応(コア移行)

  • Annotations → PHP 属性: Entity の @ORM\* → #[ORM\*]、Controller の @Route/@Template → #[Route]/#[Template](Sensio 依存除去)
  • 型宣言の明示: Entity プロパティの型付け(?int/?string/?\DateTime 等)、ゲッター/セッター・各メソッドの戻り値型
  • constructor property promotion / readonly: Controller 等の DI を現代化
  • Doctrine ORM 3.0: flush($entity) → flush()、QueryBuilder の setParameters([...]) → setParameter() へ変更(型付きパラメータ対応)
  • AbstractPluginManager: enable/disable ほか関連メソッドに : void
  • テンプレート参照: パス文字列 / @TwoFactorAuthCustomer44/... エイリアスへ統一
  • PHPUnit 11: phpunit.xml.dist を <source>/<extensions> 形式へ、Tests/bootstrap.php を追加
  • コード名: namespace / composer code / version: 4.4.0 / 管理画面ルートを TwoFactorAuthCustomer44 に統一
  • フォローアップ修正: Cookie 有効期限セッターの nullable 対応、Repository クエリパラメータ設定の修正

2. 静的解析・整形ツール

  • phpstan.neon.dist(level 6)/ Resource/rector.php / Resource/.php-cs-fixer.dist.php を追加(.php 設定は本体の Plugin\: サービス検出で 500 を避けるため Resource/ 配下に配置)
  • rector / php-cs-fixer を適用し、phpstan level 6 での検査を前提にした構成にする

3. CI(.github/workflows/main.yml ほか)

  • マトリクスを EC-CUBE 4.4 / PHP 8.2–8.5 / MySQL8・PostgreSQL に更新、checkout@v4・$GITHUB_OUTPUT 化(MySQL 5.7・4.2/4.3 対象は除外)
  • プラグイン導入を eccube:plugin:install --path=... に変更(mock-package-api 依存を除去)し、PHPUnit 実行ステップを追加
  • --ignore-platform-req=ext-redis: Symfony 7.4 の symfony/cache が古い php-redis と衝突して本体 composer install が失敗するのを回避(redis は未使用)
  • phpunit 前に cache:warmup: 有効プラグインのルートはコンテナのコンパイル時に確定するため、phpunit プロセスの遅延コンパイルだと RouteNotFoundException が断続的に発生する問題を解消
  • static-analysis ジョブ: php-cs-fixer / rector / phpstan を SQLite・PHP 8.5 の1構成で実行
  • e2e-testing.yml / ab-testing.yml: 関連プラグインコードを *44(Customer / App / Sms)に更新
  • release.yml: 配布パッケージから開発・テスト用ファイル(docker-compose / dockerbuild / CLAUDE.md / phpstan / rector / php-cs-fixer)を除外

テスト

  • EC-CUBE 4.4 環境での手動試験(コミット記載どおり)
  • CI マトリクス: 4.4 × PHP 8.2/8.3/8.4/8.5 × MySQL8/PostgreSQL
  • 静的解析ジョブ: php-cs-fixer / rector dry-run / phpstan level 6
  • 配布パッケージ(release.yml 相当)から開発用ファイルが除外されることを確認

@coderabbitai

coderabbitai Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 45a1b2bf-9b15-4621-bdd0-209659d54900

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dotani1111 dotani1111 mentioned this pull request Oct 5, 2026
@dotani1111

Copy link
Copy Markdown
Contributor

EC-CUBE 4.4 の環境で、App(#24)と SMS(TwoFactorAuthCustomerSms42 #17)のプラグインと組み合わせて動作確認を行いました。
動作に問題はありませんでした。

  • プラグインのインストール・有効化・無効化
  • 管理画面のプラグイン設定(Twilio)、店舗設定、会員編集の 2 段階認証項目
  • ログイン時の 2 段階認証(APP / SMS)
  • 重要操作ルーティングの個別認証
  • 選択中の認証方式を無効化した場合のログアウト
  • 本会員登録時の本人認証(SMS)

なお、ページ管理で編集したテンプレートが画面に反映されない点は、別 Issue で扱わせていただきます。

@ttokoro20240902 ttokoro20240902 left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修正をお願いします。

  • e2e-testing.yml は EC-CUBE 4.2 + PHP 8.0、ab-testing.yml は ec-cube の既定ブランチ(4.3)を checkout したまま *44 のプラグインを入れる形になっています。44 は 4.4 / PHP 8.2+ 専用のため動きません。4.4 + Playwright 向けに直すか、4.4 ブランチから外してください。
  • 挙動を変えた次の 2 点に PHPUnit テストを追加してください(CI に PHPUnit を追加していますが、Tests/ には bootstrap しかありません)。
    1. CustomerTwoFactorAuthService::isAuthed():認証方式が未設定の会員は false を返す(!$x === null の演算子優先順位の修正)
    2. CustomerTwoFactorAuthListener::onLoginSuccess():選択した認証方式が無効のときにログアウトへリダイレクトする(従来は戻り値が捨てられて効いていなかった)

@dotani1111 先のコメントで別 Issue とされた「ページ管理で編集したテンプレートが反映されない」件は、本 PR の #[Template] 変更が原因だったため、インラインで本 PR での修正をお願いしました(App・SMS も同様)。別 Issue は不要です。

tar cvzf ../${{ github.event.repository.name }}-${{ github.event.release.tag_name }}.tar.gz ./*
- name: Upload binaries to release of TGZ
uses: svenstaro/upload-release-action@v2
uses: svenstaro/upload-release-action@v1-release

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

svenstaro/upload-release-action が @v2 から @v1-release に戻っています(f574c25「v2に更新」の巻き戻し)。意図した変更でなければ @v2 に戻してください。

Suggested change
uses: svenstaro/upload-release-action@v1-release
uses: svenstaro/upload-release-action@v2

* @return array<string, mixed>|RedirectResponse
*/
#[Route(path: '/two_factor_auth/device_auth/input_onetime/{secret_key}', name: 'plg_customer_2fa_device_auth_input_onetime', requirements: ['secret_key' => '^[a-zA-Z0-9]+$'], methods: ['GET', 'POST'])]
#[Template('@TwoFactorAuthCustomer44/default/device_auth/input.twig')]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TwoFactorAuthCustomer44/... 形式にしたため、テンプレートが app/template/plugin/{code} → プラグインの Resource/template の順で解決され、app/template/{theme} は見なくなります。その結果、copyTwigFiles() が配置するコピーと、ページ管理(dtb_page.file_name は旧形式のまま)での編集が画面に反映されません。店頭画面は従来どおり TwoFactorAuthCustomer44/Resource/template/default/... のパス形式で指定してください(L136、TwoFactorAuthCustomerController.php:49 も同様)。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants