Skip to content

Instantly share code, notes, and snippets.

@MintayRibkins
Created January 30, 2020 11:32
Show Gist options
  • Save MintayRibkins/da786a6c13ff74af129c70b60b002c94 to your computer and use it in GitHub Desktop.
Save MintayRibkins/da786a6c13ff74af129c70b60b002c94 to your computer and use it in GitHub Desktop.
Module Example
<?php declare(strict_types=1);
namespace Hrytsenko\PluginExample\Plugin;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Psr\Log\LoggerInterface;
class ProductRepositoryExamplePlugin
{
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
}
public function beforeGetById(
ProductRepositoryInterface $subject,
$productId,
$editMode = false,
$storeId = null,
$forceReload = false
) {
$this->logger->info('Before get product by ID' . $productId);
return [$productId, $editMode, $storeId, $forceReload];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment