Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes
ObjectManager Class Reference
Inheritance diagram for ObjectManager:
ObjectManager ObjectManagerInterface

Public Member Functions

 __construct (\Magento\FunctionalTestingFramework\ObjectManager\Factory $factory=null, \Magento\FunctionalTestingFramework\ObjectManager\ConfigInterface $config=null, array $sharedInstances=[])
 
 getParameters ($type, $method)
 
 prepareArguments ($object, $method, array $arguments=[])
 
 invoke ($object, $method, array $arguments=[])
 
 __sleep ()
 
- Public Member Functions inherited from ObjectManager
 __construct (FactoryInterface $factory, ConfigInterface $config, array $sharedInstances=[])
 
 create ($type, array $arguments=[])
 
 get ($type)
 
 configure (array $configuration)
 
 __sleep ()
 

Static Public Member Functions

static setInstance (ObjectManager $objectManager)
 
static getInstance ()
 

Protected Attributes

 $factory
 
- Protected Attributes inherited from ObjectManager
 $factory
 
 $sharedInstances = []
 
 $config
 

Static Protected Attributes

static $instance
 

Detailed Description

Class ObjectManager

Responsible for instantiating objects taking into account:

@api

Definition at line 19 of file ObjectManager.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( \Magento\FunctionalTestingFramework\ObjectManager\Factory  $factory = null,
\Magento\FunctionalTestingFramework\ObjectManager\ConfigInterface  $config = null,
array  $sharedInstances = [] 
)

ObjectManager constructor.

Parameters
ObjectManager\Factory | null$factory
ObjectManager\ConfigInterface | null$config
array$sharedInstances

Definition at line 41 of file ObjectManager.php.

45  {
46  parent::__construct($factory, $config, $sharedInstances);
47  $this->sharedInstances[\Magento\FunctionalTestingFramework\ObjectManager::class] = $this;
48  }

Member Function Documentation

◆ __sleep()

__sleep ( )

Avoid to serialize Closure properties

Returns
array

Definition at line 120 of file ObjectManager.php.

121  {
122  return [];
123  }

◆ getInstance()

static getInstance ( )
static

Retrieve object manager

Returns
ObjectManager|boolean
Exceptions

Definition at line 107 of file ObjectManager.php.

108  {
109  if (!self::$instance instanceof ObjectManager) {
110  return false;
111  }
112  return self::$instance;
113  }

◆ getParameters()

getParameters (   $type,
  $method 
)

Get list of parameters for class method

Parameters
string$type
string$method
Returns
array|null

Definition at line 57 of file ObjectManager.php.

58  {
59  return $this->factory->getParameters($type, $method);
60  }
$type
Definition: item.phtml:13
$method
Definition: info.phtml:13

◆ invoke()

invoke (   $object,
  $method,
array  $arguments = [] 
)

Invoke class method with prepared arguments

Parameters
object$object
string$method
array$arguments
Returns
mixed

Definition at line 84 of file ObjectManager.php.

85  {
86  return $this->factory->invoke($object, $method, $arguments);
87  }
$method
Definition: info.phtml:13
$arguments

◆ prepareArguments()

prepareArguments (   $object,
  $method,
array  $arguments = [] 
)

Resolve and prepare arguments for class method

Parameters
object$object
string$method
array$arguments
Returns
array

Definition at line 70 of file ObjectManager.php.

71  {
72  return $this->factory->prepareArguments($object, $method, $arguments);
73  }
$method
Definition: info.phtml:13
$arguments

◆ setInstance()

static setInstance ( ObjectManager  $objectManager)
static

Set object manager instance

Parameters
ObjectManager$objectManager
Returns
void

Definition at line 96 of file ObjectManager.php.

97  {
98  self::$instance = $objectManager;
99  }
$objectManager
Definition: bootstrap.php:17

Field Documentation

◆ $factory

$factory
protected

Definition at line 26 of file ObjectManager.php.

◆ $instance

$instance
staticprotected

Definition at line 33 of file ObjectManager.php.


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