Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #74 from FrancoisMartin/master
Browse files Browse the repository at this point in the history
Fix bug when using multiple gaufrette filesystems
dizda committed Sep 4, 2015
2 parents 3c4fc62 + 270a8cf commit c7a885c
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions Client/GaufretteClient.php
Original file line number Diff line number Diff line change
@@ -12,25 +12,27 @@
*/
class GaufretteClient implements ClientInterface
{
private $filesystem;
private $filesystems;

/**
* {@inheritdoc}
*/
public function upload($archive)
{
$fileName = explode('/', $archive);
$this->filesystem->write(end($fileName), file_get_contents($archive), true);
foreach ($this->filesystems as $filesystem) {
$filesystem->write(end($fileName), file_get_contents($archive), true);
}
}

/**
* Setting Gaufrette filesystem according to bundle configurations.
*
* @param \Gaufrette\Filesystem $filesystem
*/
public function setFilesystem(Filesystem $filesystem)
public function addFilesystem(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
$this->filesystems[] = $filesystem;
}

/**
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/TaggedServicesPass.php
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ public function clientCompilerPass(ContainerBuilder $container)
foreach($filesystem as $filesystemName)
{
$gaufrette = $container->getDefinition('dizda.cloudbackup.client.gaufrette');
$gaufrette->addMethodCall('setFilesystem', [
$gaufrette->addMethodCall('addFilesystem', [
new Reference($filesystemName),
]);
}

0 comments on commit c7a885c

Please sign in to comment.