| Current Path : /home/rtorresani/www/vendor/magento/framework/Model/ResourceModel/Db/Relation/ |
| Current File : //home/rtorresani/www/vendor/magento/framework/Model/ResourceModel/Db/Relation/ActionPool.php |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Framework\Model\ResourceModel\Db\Relation;
use Magento\Framework\ObjectManagerInterface as ObjectManager;
/**
* Class ActionPool
*/
class ActionPool
{
/**
* @var ObjectManager
*/
protected $objectManager;
/**
* @var array
*/
protected $relationActions;
/**
* @param ObjectManager $objectManager
* @param array $relationActions
*/
public function __construct(
ObjectManager $objectManager,
array $relationActions = []
) {
$this->objectManager = $objectManager;
$this->relationActions = $relationActions;
}
/**
* @param string $entityType
* @param string $actionName
* @return object[]
* @throws \Exception
*/
public function getActions($entityType, $actionName)
{
$actions = [];
if (!isset($this->relationActions[$entityType][$actionName])) {
return $actions;
}
foreach ($this->relationActions[$entityType][$actionName] as $actionClassName) {
$action = $this->objectManager->get($actionClassName);
$actions[] = $action;
}
return $actions;
}
}