feat: EC-CUBE 4.4 (Symfony 7) 対応と Maker42→Maker44 改名#63
Conversation
- アノテーション → 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 に
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughプラグインをMaker42からMaker44に移行し、EC-CUBE 4.4対応として全クラスの名前空間を変更、Doctrine/ルーティングのアノテーションをPHP属性へ置換、メソッドシグネチャに型宣言を追加した。CIワークフローを更新しstatic-analysisジョブ(php-cs-fixer/rector/phpstan)を新設、関連設定ファイルとテストも合わせて更新した。 ChangesMaker44移行
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
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
レビューおねがい |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 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
📒 Files selected for processing (22)
.github/workflows/main.yml.github/workflows/release.yml.gitignoreController/MakerController.phpEntity/Maker.phpEntity/ProductTrait.phpForm/Extension/ProductTypeExtension.phpForm/Type/MakerType.phpMakerEvent.phpMakerNav.phpPluginManager.phpRepository/MakerRepository.phpResource/.php-cs-fixer.dist.phpResource/rector.phpTests/Web/Admin/MakerControllerTest.phpTests/Web/Admin/ProductMakerTest.phpTests/Web/MakerWebCommon.phpTests/Web/ProductDetailTest.phpTests/bootstrap.phpcomposer.jsonphpstan.neon.distphpunit.xml.dist
- create_date / update_date を ?\DateTime の型付きプロパティに統一 - createMakerFormData の未使用 $makerId 引数を除去
|
@CodeRabbit |
|
✅ Action performedReview finished.
|
- コメントアウトされた旧テスト 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 側に一本化する
概要
メーカー管理プラグインを EC-CUBE 4.4(Symfony 7.4 / Doctrine ORM 3.0 / PHP 8.2+) に対応させ、
Maker42→Maker44に改名します。4.3 とは非互換(属性必須・ORM3・PHP8.2+)のため新規4.4系として取り込みます。変更内容
1. EC-CUBE 4.4 対応(コア移行)
#[ORM\*]/#[Route]/#[Template](Symfony\Bridge\Twig)/#[EntityExtension](Eccube\Attribute)/#[UniqueEntity]/#[MapEntity]Types::*化、flush($entity)→flush()、Repository に@extends ServiceEntityRepository<Maker>buildForm(): void等、ProductTypeExtensionのgetExtendedType()廃止(getExtendedTypesのみ)、コンストラクタプロモーションphpunit.xml.distを<source>/<extensions>形式へ。テストに戻り値型・型注釈を付与maker_urlは 4.4 のフォーム挙動で null 保存code/ Twig 名前空間をMaker44に統一2. 静的解析・CI
phpstan.neon.dist(level 6):EntityExtensionのgetMaker()/getMakerUrl()は生成 proxy 上にしか無いためscanDirectories: app/proxy/entityでシンボル解決(proxy 経由でのみ使うProductTraitのtrait.unusedのみ限定 ignore)Resource/rector.php(Symfony 7.4 / Doctrine セット)・Resource/.php-cs-fixer.dist.php(PSR-12)static-analysisジョブを追加。リリースパッケージから開発・テスト用ファイルを除外3. 不具合修正・整理
delete(): 外部キー制約例外のみを捕捉して警告ログ+メッセージ表示、それ以外の例外は伝播。未使用Request引数を除去moveSortNo(): 該当 ID が存在しない場合も null 参照で 500 とならないようガードMakerRepository::moveSortNo()を削除、save()をvoid化手動テスト(PostgreSQL 16 / SQLite)
plg_maker作成・dtb_productにmaker_id/maker_url・proxy 生成)sort_no自動採番・create_date/update_date自動セット)maker_url保存maker_url空 → null 保存(仕様どおり)dtb_plugin削除・plg_makerテーブル削除・拡張カラム削除)