Added the possibility to add headers for a controller
Example: <?php namespace Acme\DemoBundle\Controller; use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap; use Symfony\Component\DependencyInjection\ContainerAware; /** * @Soap\Header("api_client_id", phpType = "int") * @Soap\Header("api_key", phpType = "string") */ class DefaultController extends ContainerAware { // ... }
This commit is contained in:
parent
33d1e4031c
commit
dbeb00eae2
|
@ -58,15 +58,29 @@ class AnnotationClassLoader implements LoaderInterface
|
|||
$class = new \ReflectionClass($class);
|
||||
$definition = new Definition\ServiceDefinition();
|
||||
|
||||
$serviceMethodHeaders = array();
|
||||
foreach ($this->reader->getClassAnnotations($class) as $annotation) {
|
||||
if ($annotation instanceof Annotation\Header) {
|
||||
$serviceMethodHeaders[$annotation->getValue()] = $annotation;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($class->getMethods() as $method) {
|
||||
$serviceArguments =
|
||||
$serviceHeaders = array();
|
||||
$serviceMethod =
|
||||
$serviceReturn = null;
|
||||
|
||||
foreach ($this->reader->getMethodAnnotations($method) as $i => $annotation) {
|
||||
foreach ($serviceMethodHeaders as $annotation) {
|
||||
$serviceHeaders[$annotation->getValue()] = new Definition\Header(
|
||||
$annotation->getValue(),
|
||||
$this->getArgumentType($method, $annotation)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($this->reader->getMethodAnnotations($method) as $annotation) {
|
||||
if ($annotation instanceof Annotation\Header) {
|
||||
$serviceHeaders[] = new Definition\Header(
|
||||
$serviceHeaders[$annotation->getValue()] = new Definition\Header(
|
||||
$annotation->getValue(),
|
||||
$this->getArgumentType($method, $annotation)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue