Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PurchaseFlowのPriorityが意図しないソート順になっている場合がある #6257

Closed
h-kida opened this issue Jul 29, 2024 · 2 comments
Milestone

Comments

@h-kida
Copy link
Contributor

h-kida commented Jul 29, 2024

概要(Overview)

purchaseflow.yamlで指定されているpriorityにてソートする際に、nameで指定されている単位にてソートが行われるため、異なるflow_typeのpriorityにてソートが行われpriorityの指定とは異なる順で処理が実行される部分がある。

これにより、プラグインにてPriorityを指定しイベントを追加する際も意図した順番に追加が行えない状態が発生します。

再現手順(Procedure)

purchaseflow.yamlにてAddPointProcessorとPaymentValidatorにてそれぞれ下記の設定が行われているかと思います。

(一部抜粋)
AddPointProcessor

  • { name: eccube.item.holder.post.validator, flow_type: shopping, priority: 900 }
  • { name: eccube.item.holder.post.validator, flow_type: order, priority: 1000 }

PaymentValidator

  • { name: eccube.item.holder.post.validator, flow_type: cart, priority: 1000 }
  • { name: eccube.item.holder.post.validator, flow_type: shopping, priority: 800 }

上記の設定の場合、flow_type = shopping に注目すると、
AddPointProcessorは「priority: 900 」
PaymentValidatorは「priority: 800」
となっているため、AddPointProcessor -> PaymentValidatorの順に実行されるのが正しいが、
PurchaseFlowPass.phpのfindAndSortTaggedServicesで取得を行った際に、
AddPointProcessorの「flow_type: shopping」に指定されている「priority: 900」
PaymentValidatorの「flow_type: cart」に指定されている「priority: 1000」が比較され
これの順番に基づきflow_type毎の処理順番も設定されるため、「flow_type: shopping」において
PaymentValidator -> AddPointProcessorの順で実行される状態となっている。

環境(Environment)

EC-CUBE: 4.3RC
PHP: 8.1
DB: PostgreSQL 14

@h-kida h-kida added the bug label Jul 29, 2024
@shinya
Copy link
Contributor

shinya commented Jul 29, 2024

起票ありがとうございます。
内容確認します。

systemfriend-tsuji added a commit to systemfriend-tsuji/ec-cube that referenced this issue Jul 29, 2024
purchaseFlowで呼び出すメソッドがflowTypeごとにソートされていなかったため、取得後にソートして出力するように修正
systemfriend-tsuji added a commit to systemfriend-tsuji/ec-cube that referenced this issue Jul 29, 2024
purchaseFlowで呼び出すメソッドがflowTypeごとにソートされていなかったため、flowTypeごとにソートされるように調整
@dotani1111 dotani1111 added this to the 4.3.x milestone Jul 31, 2024
dotani1111 added a commit that referenced this issue Sep 11, 2024
…_flow_priority

PurchaseFlowのPriorityが意図しないソート順になっている場合がある #6257 の修正
@dotani1111
Copy link
Contributor

マージ済のためクローズします。

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

No branches or pull requests

3 participants