Kacper Kacper - 7 months ago 15
PHP Question

Symfony 3 with AWS Client throws AnnotationException ("@http" annotation)

I'm about to use

KnpGaufretteBundle
in my Symfony 3.0 project, which uses
aws/aws-php-sdk
dependency.

I have configured my services, defined AWS credentials and client as services.

<!-- AWS -->
<service id="app.aws_credentials" class="Aws\Credentials\Credentials">
<argument>%aws_access_key_id%</argument>
<argument>%aws_secret_access_key%</argument>
</service>
<service id="app.aws_s3.client" class="Aws\S3\S3Client">
<argument type="collection">
<argument key="region">%aws_s3_region%</argument>
<argument key="version">%aws_sdk_version%</argument>
<argument key="credentials" type="service" id="app.aws_credentials"/>
</argument>
</service>


The werid part starts when I run
composer update
,
cache:clear
fails and throws:

[Doctrine\Common\Annotations\AnnotationException]
[Semantical Error] The annotation "@http" in method Aws\AwsClientInterface::getCommand() was never imported. Did you maybe forget to add a "use" statement for this annotation?


@http
doens't seem to be an annotation that does anything.

Any ideas how to solve this?

Answer

Figured this out some time ago, just forgot to mention here.

Symfony Bundle, provided by Amazon helped, available at https://github.com/aws/aws-sdk-php-symfony

I just used services provided by aws/aws-sdk-php-symfony composer package, instead of defining them by myself.

Works like a charm :)

Comments