Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ExtensionPool.php
Go to the documentation of this file.
1 <?php
8 
10 
15 {
19  protected $objectManager;
20 
24  protected $actions;
25 
30  public function __construct(
32  array $extensionActions = []
33  ) {
34  $this->objectManager = $objectManager;
35  $this->actions = $extensionActions;
36  }
37 
44  public function getActions($entityType, $actionName)
45  {
46  $actions = [];
47  if (!isset($this->actions[$entityType][$actionName])) {
48  return $actions;
49  }
50  foreach ($this->actions[$entityType][$actionName] as $actionClassName) {
51  $action = $this->objectManager->get($actionClassName);
52  if (!($action instanceof ExtensionInterface)) {
53  throw new \LogicException(get_class($action) . ' must implement ' . ExtensionInterface::class);
54  }
55  $actions[] = $action;
56  }
57  return $actions;
58  }
59 }
__construct(ObjectManagerInterface $objectManager, array $extensionActions=[])