class CommerceStockTransactionSubscriber in Commerce Stock 8
Test class to test the commerce_stock transaction events.
Hierarchy
- class \Drupal\commerce_stock_local_test\EventSubscriber\CommerceStockTransactionSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface, ContainerInjectionInterface uses LoggerChannelTrait
Expanded class hierarchy of CommerceStockTransactionSubscriber
1 string reference to 'CommerceStockTransactionSubscriber'
- commerce_stock_local_test.services.yml in modules/
local_storage/ tests/ modules/ commerce_stock_local_test/ commerce_stock_local_test.services.yml - modules/local_storage/tests/modules/commerce_stock_local_test/commerce_stock_local_test.services.yml
1 service uses CommerceStockTransactionSubscriber
- commerce_stock_local_test.event_subscriber in modules/
local_storage/ tests/ modules/ commerce_stock_local_test/ commerce_stock_local_test.services.yml - Drupal\commerce_stock_local_test\EventSubscriber\CommerceStockTransactionSubscriber
File
- modules/
local_storage/ tests/ modules/ commerce_stock_local_test/ src/ EventSubscriber/ CommerceStockTransactionSubscriber.php, line 15
Namespace
Drupal\commerce_stock_local_test\EventSubscriberView source
class CommerceStockTransactionSubscriber implements EventSubscriberInterface, ContainerInjectionInterface {
use LoggerChannelTrait;
/**
* Constructs a CommerceStockTransactionSubscriber object.
*/
public function __construct() {
}
/**
* @inheritDoc
*/
public static function create(ContainerInterface $container) {
$commerceStockTransactionSubscriber = new static();
$commerceStockTransactionSubscriber
->setLoggerFactory($container
->get('logger.factory'));
return $commerceStockTransactionSubscriber;
}
/**
* @inheritDoc
*/
public static function getSubscribedEvents() {
return [
LocalStockTransactionEvents::LOCAL_STOCK_TRANSACTION_CREATE => 'onTransactionCreate',
LocalStockTransactionEvents::LOCAL_STOCK_TRANSACTION_INSERT => 'onTransactionInsert',
];
}
/**
* Logging the create event.
*
* @param \Drupal\commerce_stock_local\Event\LocalStockTransactionEvent $event
* The event.
*/
public function onTransactionCreate(LocalStockTransactionEvent $event) {
$this
->getLogger('commerce_local_stock_test')
->debug('LOCAL_STOCK_TRANSACTION_CREATE issued', $event
->getStockTransaction());
}
/**
* Logging the insert event.
*
* @param \Drupal\commerce_stock_local\Event\LocalStockTransactionEvent $event
* The event.
*/
public function onTransactionInsert(LocalStockTransactionEvent $event) {
$this
->getLogger('commerce_local_stock_test')
->debug('LOCAL_STOCK_TRANSACTION_INSERT issued', $event
->getStockTransaction());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CommerceStockTransactionSubscriber:: |
public static | function |
@inheritDoc Overrides ContainerInjectionInterface:: |
|
CommerceStockTransactionSubscriber:: |
public static | function | @inheritDoc | |
CommerceStockTransactionSubscriber:: |
public | function | Logging the create event. | |
CommerceStockTransactionSubscriber:: |
public | function | Logging the insert event. | |
CommerceStockTransactionSubscriber:: |
public | function | Constructs a CommerceStockTransactionSubscriber object. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. |