diff --git a/doc/book/cookbook/route-specific-pipeline.md b/doc/book/cookbook/route-specific-pipeline.md index 09cb551c..a18248e0 100644 --- a/doc/book/cookbook/route-specific-pipeline.md +++ b/doc/book/cookbook/route-specific-pipeline.md @@ -58,17 +58,17 @@ middleware in order to change the instance or return an alternate instance. In this case, we'd do the latter. The following is an example: ```php -use Zend\ServiceManager\DelegatorFactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; +use Zend\ServiceManager\Factory\DelegatorFactoryInterface; +use Interop\Container\ContainerInterface; use Zend\Stratigility\MiddlewarePipe; -class ApiResourcePipelineDelegatorFactory +class ApiResourcePipelineDelegatorFactory implements DelegatorFactoryInterface { - public function createDelegatorWithName( - ServiceLocatorInterface $container, + public function __invoke( + ContainerInterface $container, $name, - $requestedName, - $callback + callable $callback, + array $options = null ) { $pipeline = new MiddlewarePipe(); @@ -98,7 +98,7 @@ return [ 'ValidationMiddleware' => '...', 'ApiResourceMiddleware' => '...', ], - 'delegator_factories' => [ + 'delegators' => [ 'ApiResourceMiddleware' => [ 'ApiResourcePipelineDelegatorFactory', ], diff --git a/doc/book/cookbook/using-zend-form-view-helpers.md b/doc/book/cookbook/using-zend-form-view-helpers.md index bc104952..657fd845 100644 --- a/doc/book/cookbook/using-zend-form-view-helpers.md +++ b/doc/book/cookbook/using-zend-form-view-helpers.md @@ -87,21 +87,23 @@ You'll first need to create a delegator factory: ```php namespace Your\Application; +use Zend\ServiceManager\Factory\DelegatorFactoryInterface; +use Interop\Container\ContainerInterface; use Zend\Form\View\HelperConfig; -use Zend\ServiceManager\DelegatorFactoryInterface; -use Zend\ServiceManager\ServiceLocatorInterface; -class FormHelpersDelegatorFactory +class FormHelpersDelegatorFactory implements DelegatorFactoryInterface { - public function createDelegatorWithName( - ServiceLocatorInterface $container, - $name, - $requestedName, - $callback + public function __invoke( + ContainerInterface $container, + $name, + callable $callback, + array $options = null ) { $helpers = $callback(); + $config = new HelperConfig(); $config->configureServiceManager($helpers); + return $helpers; } } @@ -111,13 +113,13 @@ The above creates an instance of the `Zend\Form\View\HelperConfig` class, uses it to configure the already created `Zend\View\HelperPluginManager` instance, and then returns the plugin manager instance. -From here, you'll add a `delegator_factories` configuration key in your +From here, you'll add a `delegators` configuration key in your `config/autoload/templates.global.php` file: ```php return [ 'dependencies' => [ - 'delegator_factories' => [ + 'delegators' => [ Zend\View\HelperPluginManager::class => [ Your\Application\FormHelpersDelegatorFactory::class, ],