Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Attributes
Factory Class Reference

Public Member Functions

 __construct (\Magento\Framework\ObjectManagerInterface $objectManager)
 
 create ($className, array $data=[])
 

Protected Attributes

 $_objectManager
 

Detailed Description

Definition at line 12 of file Factory.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\ObjectManagerInterface  $objectManager)

Construct

Parameters
\Magento\Framework\ObjectManagerInterface$objectManager

Definition at line 26 of file Factory.php.

27  {
28  $this->_objectManager = $objectManager;
29  }
$objectManager
Definition: bootstrap.php:17

Member Function Documentation

◆ create()

create (   $className,
array  $data = [] 
)

Create layer filter

Parameters
string$className
array$data
Returns
\Magento\Catalog\Model\Layer\Filter\Attribute
Exceptions

Definition at line 39 of file Factory.php.

40  {
41  $filter = $this->_objectManager->create($className, $data);
42 
43  if (!$filter instanceof \Magento\Catalog\Model\Layer\Filter\AbstractFilter) {
44  throw new \Magento\Framework\Exception\LocalizedException(
45  __('%1 doesn\'t extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter', $className)
46  );
47  }
48  return $filter;
49  }
__()
Definition: __.php:13
if($currentSelectedMethod==$_code) $className
Definition: form.phtml:31

Field Documentation

◆ $_objectManager

$_objectManager
protected

Definition at line 19 of file Factory.php.


The documentation for this class was generated from the following file: