Skip to content

fix: EC-CUBE 4.4 で削除される OrderItem::setTaxRuleId() の呼び出しを除去 - #199

Open
ttokoro20240902 wants to merge 1 commit into
4.4from
feature/remove-order-item-tax-rule-id
Open

fix: EC-CUBE 4.4 で削除される OrderItem::setTaxRuleId() の呼び出しを除去#199
ttokoro20240902 wants to merge 1 commit into
4.4from
feature/remove-order-item-tax-rule-id

Conversation

@ttokoro20240902

@ttokoro20240902 ttokoro20240902 commented Aug 3, 2026

Copy link
Copy Markdown

概要

close #198

EC-CUBE 本体 4.4 で非推奨 public API を撤去する EC-CUBE/ec-cube#6937 により Eccube\Entity\OrderItem::setTaxRuleId() / getTaxRuleId() が削除されるため、本プラグインからの呼び出しを除去します。

#197(EC-CUBE 4.4 対応)へのスタック PR です。base は feature/eccube-4.4-symfony7#197 がマージされたら base は自動的に 4.4 に切り替わります。

変更内容

ファイル 内容
Service/PurchaseFlow/Processor/CouponProcessor.php クーポン値引き明細生成時の setTaxRuleId($taxRuleId) と、未使用になる $taxRuleId 変数を削除。意図が失われないようコメントを残す
Tests/Service/CouponServiceTest.php テストフィクスチャの setTaxRuleId() 4 箇所を削除
Tests/Repository/CouponCouponOrderRepositoryTest.php 同 1 箇所を削除

削除だけで済む理由

  • tax_rule_id カラムは OrderItem の private プロパティとして残るため、既存データは失われません
  • 本プラグインは setTaxRuleId() による書き込みのみで、getTaxRuleId() での読み出しはありません
  • 本体 4.4 の src/ app/ にも getTaxRuleId() の呼び出しはなく、書き込んだ値の読み手が存在しません
  • 受注/配送 CSV の tax_rule(税率ルール(ID))項目は CsvExportService::getData()getTaxRule() を探す実装のため、現状でも空欄出力であり、この変更で出力は変わりません

したがって代替処理は不要で、呼び出しの削除のみで対応しています。

  • クーポン値引き明細は従来どおり「税込・税率 0%・不課税」で生成されます(setTaxRate('0') / TaxType::NON_TAXABLE は変更なし)
  • CouponServiceTest の「OrderItem に税率は設定しない」ケースは、tax_rule_id の既定値が null のため setTaxRuleId(null) の削除は挙動に影響しません

テスト

ローカルの docker-compose 4.4 環境(8.2-apache-4.4 / SQLite / PHP 8.2.31)で確認済み:

  • PHPUnit 11.5.55: 127 tests / 196 assertions パス(Failures/Errors 0、Skipped 1)※ feat: EC-CUBE 4.4への対応 #197 のレビュー指摘対応(ae08221)へリベース後に再実行
    • Skipped 1 件は feat: EC-CUBE 4.4への対応 #197 で説明済みの OrderControllerTest::testOrderEditWithCouponCancel(本体 4.4 テストハーネスの悲観ロック制約)で、本 PR とは無関係です
  • php-cs-fixer: 差分ゼロ(30 files)
  • rector: 変更ゼロ
  • phpstan level 6: エラーゼロ(baseline なし)

なお現行の本体 4.4 では OrderItem::setTaxRuleId() はまだ削除されていない(非推奨のまま)ため、本 PR の適用前後どちらでもテストは成立します。本体 PR がマージされた時点で、本 PR 未適用だと fatal error になります。

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 3, 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: Pro Plus

Run ID: 714748dc-8729-4230-acd5-ac0c324521d0

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.

EC-CUBE 本体 4.4 で非推奨 public API を撤去する EC-CUBE/ec-cube#6937 により
Eccube\Entity\OrderItem::setTaxRuleId() / getTaxRuleId() が削除されるため、
本プラグインからの呼び出しを削除する。

- Service/PurchaseFlow/Processor/CouponProcessor.php: クーポン値引き明細生成時の
  setTaxRuleId(null) と未使用になる $taxRuleId 変数を削除(意図が失われないよう
  コメントを残す)
- Tests/Service/CouponServiceTest.php / Tests/Repository/CouponCouponOrderRepositoryTest.php:
  テストフィクスチャの setTaxRuleId() 呼び出しを削除

tax_rule_id カラムは OrderItem の private プロパティとして残るため既存データに影響はなく、
書き込んだ値を読み出す実装が本体にもプラグインにも存在しないため、代替処理は不要。

Refs #198

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

EC-CUBE 4.4 対応: 削除される OrderItem::setTaxRuleId() の呼び出しを修正する

1 participant