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

Public Member Functions

 __construct (\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName=\Magento\Framework\Controller\Result\Json::class)
 
 create (array $data=[])
 

Protected Attributes

 $objectManager = null
 
 $instanceName = null
 

Detailed Description

Factory class for

See also
\Magento\Framework\Controller\Result\Json

Definition at line 12 of file JsonFactory.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\Framework\ObjectManagerInterface  $objectManager,
  $instanceName = \Magento\Framework\Controller\Result\Json::class 
)

Factory constructor

Parameters
\Magento\Framework\ObjectManagerInterface$objectManager
string$instanceName

Definition at line 34 of file JsonFactory.php.

37  {
38  $this->objectManager = $objectManager;
39  $this->instanceName = $instanceName;
40  }

Member Function Documentation

◆ create()

create ( array  $data = [])

Create class instance with specified parameters

Parameters
array$data
Returns
\Magento\Framework\Controller\Result\Json

Definition at line 48 of file JsonFactory.php.

49  {
50  return $this->objectManager->create($this->instanceName, $data);
51  }

Field Documentation

◆ $instanceName

$instanceName = null
protected

Definition at line 26 of file JsonFactory.php.

◆ $objectManager

$objectManager = null
protected

Definition at line 19 of file JsonFactory.php.


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