Fixed the ApiDocExtractor for a change in Symfony 2.1

Side note: the new code would also work for the Symfony 2.0 Routing
component, and in a more efficient way by avoiding to compile each route 3
times.
This commit is contained in:
Christophe Coevoet 2012-08-24 18:42:54 +02:00
parent 6795e118ae
commit 5f0d36f3d8

View File

@ -246,7 +246,7 @@ class ApiDocExtractor
// requirements // requirements
$requirements = array(); $requirements = array();
foreach ($route->compile()->getRequirements() as $name => $value) { foreach ($route->getRequirements() as $name => $value) {
if ('_method' !== $name) { if ('_method' !== $name) {
$requirements[$name] = array( $requirements[$name] = array(
'requirement' => $value, 'requirement' => $value,
@ -289,13 +289,13 @@ class ApiDocExtractor
// method/uri // method/uri
$annotation->setMethod($route->getRequirement('_method') ?: 'ANY'); $annotation->setMethod($route->getRequirement('_method') ?: 'ANY');
$annotation->setUri($route->compile()->getPattern()); $annotation->setUri($route->getPattern());
return $annotation; return $annotation;
} }
/** /**
* @param Reflector $reflected * @param \Reflector $reflected
* @return string * @return string
*/ */
protected function getDocComment(\Reflector $reflected) protected function getDocComment(\Reflector $reflected)
@ -315,7 +315,7 @@ class ApiDocExtractor
} }
/** /**
* @param Reflector $reflected * @param \Reflector $reflected
* @return string * @return string
*/ */
protected function getDocCommentText(\Reflector $reflected) protected function getDocCommentText(\Reflector $reflected)