Ciao a tutti,
sto cercando si usare KnpGaufretteBundle per fare l'upload dei file su
AWS S3 di amazon.
AWS S3 l'ho provato con LiipImagineBundle senza problemi (usa
aws/aws-sdk-php direttamente senza passare da gaufrette)
Ora però, cercando di usare gaufrette, non riesco ad andare avanti.
Seguendo quanto riportato in
https://github.com/KnpLabs/KnpGaufretteBundle,
definisco il servizio in services.yml:
mt.amazon_s3:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
credentials: { key: %amazon.s3.key%, secret: %amazon.s3.secret% }
region: "%amazon.s3.region%"
version: 'latest'
mt.s3_image_uploader:
class: HAL\MTBundle\Services\MTFileUploadesService
arguments: [ "@images_storage_fs" ]
Ho anche adattato la definizione per la nuova SDK di amazon.
In config.yml ho la seguente configurazione:
knp_gaufrette:
adapters:
photo_storage:
amazon_s3:
amazon_s3_id: "mt.amazon_s3"
bucket_name: "%amazon.s3.cache_bucket%"
options:
directory: 'uploaded_images'
create: true
filesystems:
photo_storage:
adapter: photo_storage
alias: images_storage_fs
Quando però uso il servizio mt.s3_image_uploader, ho il seguente errore:
Catchable Fatal Error: Argument 1 passed to
Gaufrette\Adapter\AmazonS3::__construct() must be an instance of
AmazonS3, instance of Aws\S3\S3Client
Il composer.json mi da le seguenti versioni:
"aws/aws-sdk-php": "^3.17",
"aws/aws-sdk-php-symfony": "^1.1",
"knplabs/knp-gaufrette-bundle": "^0.3.0"
Ho provato a usare Gaufrette\Adapter\AmazonS3 ma con scarsi successi.
Qualcuno può darmi un suggerimento o indicarmi una fonte di
informazioni al riguardo ?
Luca
--
It is easier to move a problem around (for example, by moving the
problem to a different part of the overall network architecture) than
it is to solve it.
6th truth - rfc1925
------------------------------------------------------------------
Einstein: Imagination is more important than knowledge. For knowledge
is limited, whereas imagination embraces the entire world, stimulating
progress, giving birth to evolution.
------------------------------------------------------------------
Heinlein: Specialization is for Insects