Skip to content

Commit fe561ad

Browse files
committed
fix
1 parent 9352e1f commit fe561ad

File tree

2 files changed

+29
-8
lines changed

2 files changed

+29
-8
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ one Datasrouce has one S3 Bucket connection.
3131
'key' => 'put your s3 access key',
3232
'secret' => 'put your s3 access secret',
3333
'bucketName' => 'put your bucket name',
34+
'region' => 'put your region',
3435
],
3536
],
3637
```
@@ -42,7 +43,7 @@ Setup new table using s3 connection.
4243

4344
```
4445
<?php
45-
namespace App\Model\Table\;
46+
namespace App\Model\Table;
4647
4748
use CakeS3\Datasource\AwsS3Table;
4849
@@ -52,7 +53,7 @@ class MyS3Table extends AwsS3Table
5253
}
5354
```
5455

55-
For example, declare action of get & show S3 Object.
56+
For example, declare action of get & show S3 Object.
5657

5758
```
5859
class TopController extends Controller
@@ -61,10 +62,10 @@ class TopController extends Controller
6162
{
6263
$MyS3Table = TableRegistry::get('MyS3');
6364
$content = $MyS3Table->getObjectBody('/path/to/object/file.jpg');
64-
65+
6566
$this->response->type('image/jpeg');
6667
$this->response->body($content);
67-
68+
6869
return $this->response;
6970
}
7071
}
@@ -77,7 +78,7 @@ class TopController extends Controller
7778

7879
The methods can call on your S3 Table.
7980

80-
If You want more detail, go to S3Client document.
81+
If You want more detail, go to S3Client document.
8182
[http://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.S3.S3Client.html](http://docs.aws.amazon.com/aws-sdk-php/v3/api/class-Aws.S3.S3Client.html)
8283

8384
#### ```copyObject(string $srcKey, string $destKey, array $options = []) : \Aws\Result```

src/Datasource/Connection.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,8 @@ public function __construct(array $config = [])
4242
]);
4343
$this->_s3Client->registerStreamWrapper();
4444

45-
if ($this->_s3Client->doesBucketExist($this->_config['bucketName']) === false) {
46-
throw new \InvalidArgumentException("Bucket '{$this->_config['bucketName']}' is not found.");
47-
}
45+
// check has bucket
46+
$this->_s3Client->getCommand('HeadBucket', ['Bucket' => $this->_config['bucketName']]);
4847
}
4948

5049
/**
@@ -107,6 +106,27 @@ public function logger($instance = null)
107106
{
108107
}
109108

109+
/**
110+
* This method is not supported.
111+
*
112+
* @return \Cake\Database\Log\QueryLogger logger instance
113+
*/
114+
public function getLogger()
115+
{
116+
return new \Cake\Database\Log\QueryLogger();
117+
}
118+
119+
/**
120+
* This method is not supported.
121+
*
122+
* @param \Cake\Database\Log\QueryLogger $logger Logger object
123+
* @return $this
124+
*/
125+
public function setLogger($logger)
126+
{
127+
return $this;
128+
}
129+
110130
/**
111131
* Pre processing to convert the key.
112132
* ex) '/key' => 'key'

0 commit comments

Comments
 (0)