Skip to content

Commit 5d27e32

Browse files
authored
Merge pull request #16 from Xerkus/hotfix/servicemanager-v3-compat
Update documentation controller factory to match factory interface signature
2 parents 6bba40a + a5536f3 commit 5d27e32

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/SwaggerModule/Controller/DocumentationControllerFactory.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
namespace SwaggerModule\Controller;
2222

2323
use Interop\Container\ContainerInterface;
24+
use Swagger\Annotations\Swagger;
2425
use Zend\ServiceManager\AbstractFactoryInterface;
26+
use Zend\ServiceManager\AbstractPluginManager;
2527
use Zend\ServiceManager\ServiceLocatorInterface;
2628

2729
class DocumentationControllerFactory implements AbstractFactoryInterface
@@ -36,17 +38,20 @@ public function canCreateServiceWithName(ServiceLocatorInterface $services, $nam
3638
return $this->canCreate($services, $requestedName);
3739
}
3840

39-
public function __invoke(ContainerInterface $container, $requestedName)
41+
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
4042
{
4143
$controller = new DocumentationController();
42-
/** @var \Swagger\Annotations\Swagger */
43-
$swagger = $container->getServiceLocator()->get('Swagger\Annotations\Swagger');
44+
/** @var Swagger $swagger */
45+
$swagger = $container->get('Swagger\Annotations\Swagger');
4446
$controller->setSwagger($swagger);
4547
return $controller;
4648
}
4749

4850
public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
4951
{
52+
if ($services instanceof AbstractPluginManager) {
53+
$services = $services->getServiceLocator();
54+
}
5055
return $this($services, $requestedName);
5156
}
52-
}
57+
}

0 commit comments

Comments
 (0)