Skip to content

Commit

Permalink
Rename event
Browse files Browse the repository at this point in the history
  • Loading branch information
nfourtythree committed Jul 13, 2023
1 parent 174c17c commit bc4cf9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/controllers/OrdersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
use craft\commerce\errors\OrderStatusException;
use craft\commerce\errors\RefundException;
use craft\commerce\errors\TransactionException;
use craft\commerce\events\ModifyPurchasablesQueryEvent;
use craft\commerce\events\ModifyPurchasablesTableQueryEvent;
use craft\commerce\gateways\MissingGateway;
use craft\commerce\helpers\Currency;
use craft\commerce\helpers\DebugPanel;
Expand Down Expand Up @@ -85,14 +85,14 @@ class OrdersController extends Controller
*
* Event::on(
* OrdersController::class,
* OrdersController::EVENT_MODIFY_PURCHASABLES_QUERY,
* OrdersController::EVENT_MODIFY_PURCHASABLES_TABLE_QUERY,
* function(ModifyCartInfoEvent $e) {
* $e->query->andWhere(['sku' => 'foo']);
* }
* );
* ```
*/
public const EVENT_MODIFY_PURCHASABLES_QUERY = 'modifyPurchasablesQuery';
public const EVENT_MODIFY_PURCHASABLES_TABLE_QUERY = 'modifyPurchasablesTableQuery';

/**
* @throws HttpException
Expand Down Expand Up @@ -565,12 +565,12 @@ public function actionPurchasablesTable(): Response
}

// Trigger event before working out the total and limiting the results for pagination
if ($this->hasEventHandlers(self::EVENT_MODIFY_PURCHASABLES_QUERY)) {
$event = new ModifyPurchasablesQueryEvent([
if ($this->hasEventHandlers(self::EVENT_MODIFY_PURCHASABLES_TABLE_QUERY)) {
$event = new ModifyPurchasablesTableQueryEvent([
'query' => $sqlQuery,
'search' => $search,
]);
$this->trigger(self::EVENT_MODIFY_PURCHASABLES_QUERY, $event);
$this->trigger(self::EVENT_MODIFY_PURCHASABLES_TABLE_QUERY, $event);
$sqlQuery = $event->query;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
use yii\base\Event;

/**
* ModifyPurchasablesQueryEvent class.
* ModifyPurchasablesTableQueryEvent class.
*
* @author Pixel & Tonic, Inc. <support@pixelandtonic.com>
* @since 4.3.0
*/
class ModifyPurchasablesQueryEvent extends Event
class ModifyPurchasablesTableQueryEvent extends Event
{
/**
* @var Query
Expand Down

0 comments on commit bc4cf9a

Please sign in to comment.