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

[5.4] Reports #3628

Draft
wants to merge 8 commits into
base: 5.x
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Use UID
  • Loading branch information
lukeholder committed Nov 6, 2024
commit c95eb01922381767aae6739af2f0af072036b517
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use craft\commerce\elements\Order;
use craft\commerce\Plugin;
use craft\elements\conditions\ElementConditionRuleInterface;
use craft\helpers\ArrayHelper;
use yii\db\QueryInterface;

/**
Expand Down Expand Up @@ -41,7 +42,7 @@ public function getExclusiveQueryParams(): array
protected function options(): array
{
return Plugin::getInstance()->getGateways()->getAllGateways()->mapWithKeys(function($gateway) {
return [$gateway->id => $gateway->name];
return [$gateway->uid => $gateway->name];
})->all();
}

Expand All @@ -50,8 +51,9 @@ protected function options(): array
*/
public function modifyQuery(QueryInterface $query): void
{
$gateway = Plugin::getInstance()->getGateways()->getAllGateways()->firstWhere('uid', $this->value);
/** @var OrderQuery $query */
$query->gatewayId($this->value);
$query->gatewayId($gateway->id);
}

/**
Expand All @@ -60,6 +62,7 @@ public function modifyQuery(QueryInterface $query): void
public function matchElement(ElementInterface $element): bool
{
/** @var Order $element */
return $this->matchValue($element->gatewayId);
$gatewayUid = $element->getGateway()?->uid;
return $this->matchValue($gatewayUid);
}
}
Loading