mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Merge pull request #695 from ogizanagi/fix_callable_controllers
Fix ApiDocExtractor to accept callable classes as controllers
This commit is contained in:
commit
874c8752e6
@ -211,14 +211,20 @@ class ApiDocExtractor
|
||||
if (preg_match('#(.+)::([\w]+)#', $controller, $matches)) {
|
||||
$class = $matches[1];
|
||||
$method = $matches[2];
|
||||
} elseif (preg_match('#(.+):([\w]+)#', $controller, $matches)) {
|
||||
} else {
|
||||
if (preg_match('#(.+):([\w]+)#', $controller, $matches)) {
|
||||
$controller = $matches[1];
|
||||
$method = $matches[2];
|
||||
}
|
||||
|
||||
if ($this->container->has($controller)) {
|
||||
$this->container->enterScope('request');
|
||||
$this->container->set('request', new Request(), 'request');
|
||||
$class = ClassUtils::getRealClass(get_class($this->container->get($controller)));
|
||||
$this->container->leaveScope('request');
|
||||
if (!isset($method) && method_exists($class, '__invoke')) {
|
||||
$method = '__invoke';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user