class EntityCrud in Payment 8.2
Implements hook_entity_CRUD().
Hierarchy
- class \Drupal\payment\Hook\EntityCrud
Expanded class hierarchy of EntityCrud
1 file declares its use of EntityCrud
- EntityCrudTest.php in tests/
src/ Unit/ Hook/ EntityCrudTest.php
1 string reference to 'EntityCrud'
1 service uses EntityCrud
File
- src/
Hook/ EntityCrud.php, line 13
Namespace
Drupal\payment\HookView source
class EntityCrud {
/**
* The payment method manager.
*
* @var \Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface
*/
protected $paymentMethodManager;
/**
* The payment status plugin manager.
*
* @var \Drupal\payment\Plugin\Payment\Status\PaymentStatusManagerInterface
*/
protected $paymentStatusManager;
/**
* Constructs a new instance.
*
* @param \Drupal\payment\Plugin\Payment\Method\PaymentMethodManagerInterface $payment_method_manager
* The payment method plugin manager.
* @param \Drupal\payment\Plugin\Payment\Status\PaymentStatusManagerInterface $payment_status_manager
* The payment status plugin manager.
*/
public function __construct(PaymentMethodManagerInterface $payment_method_manager, PaymentStatusManagerInterface $payment_status_manager) {
$this->paymentMethodManager = $payment_method_manager;
$this->paymentStatusManager = $payment_status_manager;
}
/**
* Invokes the implementation.
*/
public function invoke(EntityInterface $entity) {
if ($entity
->getEntityTypeId() == 'payment_method_configuration') {
$manager = $this->paymentMethodManager;
}
elseif ($entity
->getEntityTypeId() == 'payment_status') {
$manager = $this->paymentStatusManager;
}
if (isset($manager) && $manager instanceof CachedDiscoveryInterface) {
$manager
->clearCachedDefinitions();
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityCrud:: |
protected | property | The payment method manager. | |
EntityCrud:: |
protected | property | The payment status plugin manager. | |
EntityCrud:: |
public | function | Invokes the implementation. | |
EntityCrud:: |
public | function | Constructs a new instance. |