Skip to content

feat: EC-CUBE 4.4 (Symfony 7) 対応と Maker42→Maker44 改名#63

Open
dotani1111 wants to merge 6 commits into
EC-CUBE:4.4from
dotani1111:feature/eccube-4.4-symfony7
Open

feat: EC-CUBE 4.4 (Symfony 7) 対応と Maker42→Maker44 改名#63
dotani1111 wants to merge 6 commits into
EC-CUBE:4.4from
dotani1111:feature/eccube-4.4-symfony7

Conversation

@dotani1111

@dotani1111 dotani1111 commented Jul 6, 2026

Copy link
Copy Markdown

概要

メーカー管理プラグインを EC-CUBE 4.4(Symfony 7.4 / Doctrine ORM 3.0 / PHP 8.2+) に対応させ、Maker42Maker44 に改名します。4.3 とは非互換(属性必須・ORM3・PHP8.2+)のため新規 4.4 系として取り込みます。

変更内容

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

  • アノテーション → PHP 属性: #[ORM\*] / #[Route] / #[Template]Symfony\Bridge\Twig)/ #[EntityExtension]Eccube\Attribute)/ #[UniqueEntity] / #[MapEntity]
  • Doctrine ORM 3: Entity を型付きプロパティ + Types::* 化、flush($entity)flush()、Repository に @extends ServiceEntityRepository<Maker>
  • Symfony 7: FormType buildForm(): void 等、ProductTypeExtensiongetExtendedType() 廃止(getExtendedTypes のみ)、コンストラクタプロモーション
  • PHPUnit 11: phpunit.xml.dist<source>/<extensions> 形式へ。テストに戻り値型・型注釈を付与
  • 空の任意 maker_url は 4.4 のフォーム挙動で null 保存
  • namespace / composer code / Twig 名前空間を Maker44 に統一

2. 静的解析・CI

  • phpstan.neon.dist(level 6): EntityExtensiongetMaker()/getMakerUrl() は生成 proxy 上にしか無いため scanDirectories: app/proxy/entity でシンボル解決(proxy 経由でのみ使う ProductTraittrait.unused のみ限定 ignore)
  • Resource/rector.php(Symfony 7.4 / Doctrine セット)・Resource/.php-cs-fixer.dist.php(PSR-12)
  • CI を 4.4 × PHP 8.2-8.5 × MySQL8/PostgreSQL に更新し static-analysis ジョブを追加。リリースパッケージから開発・テスト用ファイルを除外

3. 不具合修正・整理

  • delete(): 外部キー制約例外のみを捕捉して警告ログ+メッセージ表示、それ以外の例外は伝播。未使用 Request 引数を除去
  • moveSortNo(): 該当 ID が存在しない場合も null 参照で 500 とならないようガード
  • デッドコード MakerRepository::moveSortNo() を削除、save()void

手動テスト(PostgreSQL 16 / SQLite)

  • install → enable(SQLite / PgSQL)
  • スキーマ反映(plg_maker 作成・dtb_productmaker_id/maker_url・proxy 生成)
  • 管理メニュー「商品管理 > メーカー管理」表示
  • メーカー新規登録(sort_no 自動採番・create_date/update_date 自動セット)
  • メーカーのインライン編集
  • 並び替え(ドラッグ&ドロップ)
  • 未参照メーカーの削除 → 正常に削除
  • 参照中メーカーの削除(PgSQL)→ FK 制約で中止・「関連するデータがあるため削除できませんでした」表示・500 なし
  • 削除後のデータ整合(参照中メーカーは残存・商品の参照継続)
  • 商品へのメーカー割当+maker_url 保存
  • maker_url 空 → null 保存(仕様どおり)
  • フロント商品詳細でメーカー表示(URL 有→リンク)→ 購入完了
  • disable → uninstall のクリーンアップ(dtb_plugin 削除・plg_maker テーブル削除・拡張カラム削除)

- アノテーション → PHP 属性: #[ORM\*] / #[Route] / #[Template] / #[EntityExtension] / #[UniqueEntity] / #[MapEntity]
- Doctrine ORM 3: Entity を型付きプロパティ + Types::* 化、flush() の単一引数を除去、Repository に @extends を付与
- Symfony 7: FormType の buildForm(): void 等、ProductTypeExtension の getExtendedType() を廃止(getExtendedTypes のみ)
- PHPUnit 11: phpunit.xml.dist を source/extensions 形式へ、テストに戻り値型・型注釈を付与
- 空の任意 maker_url は 4.4 のフォーム挙動で null 保存となるためテスト期待値を追従
- namespace / composer code / Twig 名前空間を Maker44 に統一
- phpstan level 6: EntityExtension の getMaker()/getMakerUrl() は生成 proxy 上にしか無いため scanDirectories: app/proxy/entity でシンボル解決(proxy 経由でのみ使う ProductTrait の trait.unused のみ限定 ignore)
- Rector(Symfony 7.4 / Doctrine セット)と PHP-CS-Fixer(PSR-12)設定を Resource/ に配置
- CI を EC-CUBE 4.4 × PHP 8.2-8.5 × MySQL8/PostgreSQL に更新し static-analysis ジョブを追加
- リリースパッケージから開発・テスト用ファイル(Tests / phpstan / rector / php-cs-fixer)を除外
- delete(): 外部キー制約例外のみ捕捉して警告ログ+メッセージ表示にし、それ以外の例外(DB 障害等)は握り潰さず伝播させる(全例外を「外部キー制約」と誤表示していた不具合を修正)。未使用の Request 引数も除去
- moveSortNo(): 該当 ID が無い場合に null 参照で 500 になるのを回避
- 呼び出されないデッドコード MakerRepository::moveSortNo() を削除し、常に true を返すだけの save() を void に
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

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: Pro

Run ID: 2502a12c-cae8-4b85-af66-d839f1b2ac7c

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
📝 Walkthrough

Walkthrough

プラグインをMaker42からMaker44に移行し、EC-CUBE 4.4対応として全クラスの名前空間を変更、Doctrine/ルーティングのアノテーションをPHP属性へ置換、メソッドシグネチャに型宣言を追加した。CIワークフローを更新しstatic-analysisジョブ(php-cs-fixer/rector/phpstan)を新設、関連設定ファイルとテストも合わせて更新した。

Changes

Maker44移行

Layer / File(s) Summary
パッケージメタ情報とnamespace基盤
composer.json, PluginManager.php, Form/Type/MakerType.php, MakerEvent.php, MakerNav.php
パッケージ名・バージョン・コード識別子をMaker44に更新し、各クラスのnamespaceを変更。
EntityとProductTraitの属性化
Entity/Maker.php, Entity/ProductTrait.php
DoctrineマッピングをアノテーションからPHP属性に変更し、getter/setterに型宣言を追加。
Repositoryの型厳格化
Repository/MakerRepository.php
コンストラクタ引数、save/deleteメソッドに型宣言を追加し、flush呼び出し方法を変更。
フォームクラスの属性化
Form/Extension/ProductTypeExtension.php, Form/Type/MakerType.php
コンストラクタプロモーション化、Assert制約の名前付き引数化、getExtendedTypesの静的メソッド化。
Controllerのルーティング属性化と例外処理
Controller/MakerController.php
ルーティング/テンプレート指定を属性化し、削除時の例外を外部キー制約専用に、moveSortNoにnull分岐を追加。
テストの移行と更新
Tests/Web/...
namespace移行、戻り値型void付与、KernelBrowser/RedirectResponse型注釈、リダイレクト検証やmaker_url期待値の更新。
CI/静的解析導入
.github/workflows/*.yml, .gitignore, phpstan.neon.dist, phpunit.xml.dist, Resource/*
CIをMaker44/ECCUBE4.4向けに更新しstatic-analysisジョブを追加、配布物除外とツール設定ファイルを新規追加。

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant MakerController
  participant MakerRepository
  participant Database

  Client->>MakerController: delete(Maker)
  MakerController->>MakerRepository: delete(Maker)
  MakerRepository->>Database: flush()
  Database-->>MakerRepository: ForeignKeyConstraintViolationException
  MakerRepository-->>MakerController: 例外伝播
  MakerController->>MakerController: 警告ログ記録
  MakerController-->>Client: RedirectResponse
Loading

Poem

42から44へ、ぴょんと跳ねて
属性つけたコード、ぴかぴか輝く
CIも一緒に、うさぎ跳びで駆けて
型を揃えて、みんな安心
🐰✨ ぴょんぴょん、リリースの日を待つよ

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed EC-CUBE 4.4/Symfony 7対応とMaker42→Maker44への改名という主要変更を適切に要約しています。
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Copy link
Copy Markdown
Author

@CodeRabbit

レビューおねがい

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

@dotani1111 レビューを開始します。少々お待ちください。

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (2)
Tests/Web/Admin/MakerControllerTest.php (1)

355-375: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

$makerId パラメータが未使用です。

createMakerFormData($makerId = null) は編集テスト(testMakerInlineEditNameIsEmpty など)から $Maker->getId() を渡されていますが、メソッド内で $makerId を一切利用していません。編集用フォームデータに id を含める意図だったのであれば実装漏れ、意図的に不要なら引数自体を削除すべきです。

♻️ 不要な引数を削除する場合の例
-    private function createMakerFormData($makerId = null): array
+    private function createMakerFormData(): array
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Tests/Web/Admin/MakerControllerTest.php` around lines 355 - 375, The
createMakerFormData helper in MakerControllerTest accepts a $makerId argument
but never uses it, so either remove the unused parameter from the helper and its
callers if it is not needed, or wire it into the returned form data if the edit
tests such as testMakerInlineEditNameIsEmpty expect an id field. Update the
helper signature and any related test calls consistently, using
createMakerFormData and the maker-specific edit tests as the main points to
locate the change.

Source: Linters/SAST tools

Entity/Maker.php (1)

41-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

create_date/update_date プロパティに型宣言がない

id/name/sort_no?int/?string で型付けされていますが、create_date/update_date は依然として型なしプロパティのままです(@var \DateTime の DocBlock のみ)。ORM 3 対応で型付きプロパティへ移行する意図と一貫性がありません。

♻️ 提案: 型宣言を追加
-    /**
-     * `@var` \DateTime
-     */
     #[ORM\Column(name: 'create_date', type: Types::DATETIMETZ_MUTABLE)]
-    private $create_date;
+    private ?\DateTime $create_date = null;

-    /**
-     * `@var` \DateTime
-     */
     #[ORM\Column(name: 'update_date', type: Types::DATETIMETZ_MUTABLE)]
-    private $update_date;
+    private ?\DateTime $update_date = null;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Entity/Maker.php` around lines 41 - 51, The Maker entity’s create_date and
update_date fields are still untyped properties despite the existing Doctrine
mapping and the same class using typed properties for id/name/sort_no. Update
the Maker class to use explicit DateTime-related property type declarations for
create_date and update_date, keeping the ORM\Column annotations intact and
matching the typing style used by the other fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@Entity/Maker.php`:
- Around line 41-51: The Maker entity’s create_date and update_date fields are
still untyped properties despite the existing Doctrine mapping and the same
class using typed properties for id/name/sort_no. Update the Maker class to use
explicit DateTime-related property type declarations for create_date and
update_date, keeping the ORM\Column annotations intact and matching the typing
style used by the other fields.

In `@Tests/Web/Admin/MakerControllerTest.php`:
- Around line 355-375: The createMakerFormData helper in MakerControllerTest
accepts a $makerId argument but never uses it, so either remove the unused
parameter from the helper and its callers if it is not needed, or wire it into
the returned form data if the edit tests such as testMakerInlineEditNameIsEmpty
expect an id field. Update the helper signature and any related test calls
consistently, using createMakerFormData and the maker-specific edit tests as the
main points to locate the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: af0bed78-2c1c-4a77-b630-038f8591d975

📥 Commits

Reviewing files that changed from the base of the PR and between 2ec82a9 and f38b691.

📒 Files selected for processing (22)
  • .github/workflows/main.yml
  • .github/workflows/release.yml
  • .gitignore
  • Controller/MakerController.php
  • Entity/Maker.php
  • Entity/ProductTrait.php
  • Form/Extension/ProductTypeExtension.php
  • Form/Type/MakerType.php
  • MakerEvent.php
  • MakerNav.php
  • PluginManager.php
  • Repository/MakerRepository.php
  • Resource/.php-cs-fixer.dist.php
  • Resource/rector.php
  • Tests/Web/Admin/MakerControllerTest.php
  • Tests/Web/Admin/ProductMakerTest.php
  • Tests/Web/MakerWebCommon.php
  • Tests/Web/ProductDetailTest.php
  • Tests/bootstrap.php
  • composer.json
  • phpstan.neon.dist
  • phpunit.xml.dist

- create_date / update_date を ?\DateTime の型付きプロパティに統一
- createMakerFormData の未使用 $makerId 引数を除去
@dotani1111

Copy link
Copy Markdown
Author

@CodeRabbit
修正しました、再度お願いします。

@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

@dotani1111 承知しました。修正内容を確認し、再度レビューいたします。少々お待ちください。

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

- コメントアウトされた旧テスト testMakerEditIdIsNotFound を削除
- CI: services の MYSQL_DATABASE/POSTGRES_DB を未定義の matrix.dbname から eccube_db リテラルに
- rector: DBAL は 4.x だが DBAL4 用セットが無く DBAL30 を流用する旨をコメントに明記
- services の MYSQL_DATABASE/POSTGRES_DB を除去。サービスが eccube_db を
  先に作ると doctrine:database:create が二重作成で失敗するため、DB 作成は
  console 側に一本化する
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.

2 participants