3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
10 namespace Zend\Mvc\Service
;
12 use Interop\Container\ContainerInterface
;
15 use Zend\ServiceManager\FactoryInterface
;
16 use Zend\ServiceManager\ServiceLocatorInterface
;
19 * @deprecated Since 2.7.9. The factory is now defined in zend-servicemanager-di,
20 * and removed in 3.0.0. Use Zend\ServiceManager\Di\DiFactory from
21 * from zend-servicemanager-di if you are using zend-servicemanager v3, and/or when
22 * ready to migrate to zend-mvc 3.0.
24 class DiFactory
implements FactoryInterface
27 * Create and return abstract factory seeded by dependency injector
29 * Creates and returns an abstract factory seeded by the dependency
30 * injector. If the "di" key of the configuration service is set, that
31 * sub-array is passed to a DiConfig object and used to configure
32 * the DI instance. The DI instance is then used to seed the
33 * DiAbstractServiceFactory, which is then registered with the service
36 * @param ContainerInterface $container
38 * @param null|array $options
41 public function __invoke(ContainerInterface
$container, $name, array $options = null)
44 $config = $container->has('config') ?
$container->get('config') : [];
46 if (isset($config['di'])) {
47 (new Config($config['di']))->configure($di);
54 * Create and return Di instance
56 * For use with zend-servicemanager v2; proxies to __invoke().
58 * @param ServiceLocatorInterface $container
61 public function createService(ServiceLocatorInterface
$container)
63 return $this($container, Di
::class);