Skip to content

Commit

Permalink
Merge pull request #16 from Xerkus/hotfix/servicemanager-v3-compat
Browse files Browse the repository at this point in the history
Update documentation controller factory to match factory interface signature
  • Loading branch information
davidwindell authored Jul 22, 2020
2 parents 6bba40a + a5536f3 commit 5d27e32
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/SwaggerModule/Controller/DocumentationControllerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
namespace SwaggerModule\Controller;

use Interop\Container\ContainerInterface;
use Swagger\Annotations\Swagger;
use Zend\ServiceManager\AbstractFactoryInterface;
use Zend\ServiceManager\AbstractPluginManager;
use Zend\ServiceManager\ServiceLocatorInterface;

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

public function __invoke(ContainerInterface $container, $requestedName)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$controller = new DocumentationController();
/** @var \Swagger\Annotations\Swagger */
$swagger = $container->getServiceLocator()->get('Swagger\Annotations\Swagger');
/** @var Swagger $swagger */
$swagger = $container->get('Swagger\Annotations\Swagger');
$controller->setSwagger($swagger);
return $controller;
}

public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
{
if ($services instanceof AbstractPluginManager) {
$services = $services->getServiceLocator();
}
return $this($services, $requestedName);
}
}
}

0 comments on commit 5d27e32

Please sign in to comment.