zfcampus / zf-apigility-documentation-swagger

BSD 3-Clause "New" or "Revised" License
11 stars 27 forks source link

SwaggerUiControllerFactory error #25

Closed Iraecio closed 8 years ago

Iraecio commented 8 years ago

today tried to use a swagger in apigility project and found the following error. 1

/**
     * Create and return a SwaggerUiController instance.
     *
     * @param ContainerInterface $container
     * @param string $requestedName
     * @param null|array $options
     * @return SwaggerUiController
     * @throws ServiceNotCreatedException when ApiFactory service is missing.
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        if (! $container->has(ApiFactory::class)) {
            throw new ServiceNotCreatedException(sprintf(
                '%s requires the service %s, which was not found',
                SwaggerUiController::class,
                ApiFactory::class
            ));
        }

         return new SwaggerUiController($services->get(ApiFactory::class));
    }

I found that only this line had problem

return new SwaggerUiController($services->get(ApiFactory::class));

I changed $services to $container and so

return new SwaggerUiController($container->get(ApiFactory::class));

2

olibri-us commented 8 years ago

I run into the same issue here, in version 1.1 and 1.2 The fix does work, can you patch the master please ?