Zend\Di\Di
Dependency injector that can generate instances using class definitions and configured instance parameters
Synopsis
class Di
implements
DependencyInjectionInterface
{
- // constants
- const RESOLVE_EAGER = 1;
- const RESOLVE_STRICT = 2;
- const METHOD_IS_OPTIONAL = 0;
- const METHOD_IS_AWARE = 1;
- const METHOD_IS_CONSTRUCTOR = 3;
- const METHOD_IS_INSTANTIATOR = 3;
- const METHOD_IS_REQUIRED = 3;
- const METHOD_IS_EAGER = 1;
- // members
- protected DefinitionList $definitions;
- protected InstanceManager $instanceManager;
- protected array $instanceContext;
- protected array $currentDependencies;
- protected array $currentAliasDependenencies;
- protected array $references;
- // methods
- public void __construct()
- public void configure()
- public self setDefinitionList()
- public DefinitionList definitions()
- public Di setInstanceManager()
- public InstanceManager instanceManager()
- protected array getCallParameters()
- public object|null get()
- public object|null newInstance()
- public void injectDependencies()
- protected void handleInjectDependencies()
- protected createInstanceViaConstructor()
- protected createInstanceViaCallback()
- protected bool resolveAndCallInjectionMethodForInstance()
- protected array resolveMethodParameters()
- protected string getClass()
- protected static bool isSubclassOf()
Hierarchy
Extended by
- Zend\Mvc\Service\DiStrictAbstractServiceFactory
- Zend\Di\ServiceLocator\DependencyInjectorProxy
- Zend\ServiceManager\Di\DiAbstractServiceFactory
- Zend\ServiceManager\Di\DiServiceFactory
- Zend\ServiceManager\Di\DiServiceInitializer
Implements
Constants
Name | Value |
---|---|
RESOLVE_EAGER | 1 |
RESOLVE_STRICT | 2 |
METHOD_IS_OPTIONAL | 0 |
METHOD_IS_AWARE | 1 |
METHOD_IS_CONSTRUCTOR | 3 |
METHOD_IS_INSTANTIATOR | 3 |
METHOD_IS_REQUIRED | 3 |
METHOD_IS_EAGER | 1 |
Members
protected
- $currentAliasDependenencies
—
array
All the dependenent aliases - $currentDependencies
—
array
All the class dependencies [source][dependency] - $definitions — Zend\Di\DefinitionList
- $instanceContext — string
- $instanceManager — Zend\Di\InstanceManager
- $references
—
array
All the class references [dependency][source]
Methods
protected
- createInstanceViaCallback() — Get an object instance from the defined callback
- createInstanceViaConstructor() — Retrieve a class instance based on class name
- getCallParameters()
- getClass() — Utility method used to retrieve the class of a particular instance. This is here to allow extending classes to override how class names are resolved
- handleInjectDependencies()
- isSubclassOf() — Checks if the object has this class as one of its parents
- resolveAndCallInjectionMethodForInstance() — This parameter will handle any injection methods and resolution of dependencies for such methods
- resolveMethodParameters() — Resolve parameters referencing other services
public
- __construct() — Constructor
- configure() — Provide a configuration object to configure this instance
- definitions()
- get() — Lazy-load a class
- injectDependencies() — Inject dependencies
- instanceManager()
- newInstance() — Retrieve a new instance of a class
- setDefinitionList()
- setInstanceManager() — Set the instance manager