Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ stages:
- test

php:
- '7.1'
- '7.2'
- '7.3'

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,3 +609,4 @@ Author and Contributors
* [Quang Ngo](https://github.com/vanquang9387)
* [David Higgins](https://github.com/zoul0813)
* [Damon Williams](https://github.com/footballencarta)
* [David Palmer](https://github.com/dp88)
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"keywords": ["laravel", "dynamodb", "aws"],
"require": {
"aws/aws-sdk-php": "^3.0.0",
"illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*",
"illuminate/database": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.*"
"illuminate/support": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.0.*",
"illuminate/database": "5.1.* || 5.2.* || 5.3.* || 5.4.* || 5.5.* || 5.6.* || 5.7.* || 5.8.* || 6.0.*"
},
"license": "MIT",
"authors": [
Expand Down
9 changes: 5 additions & 4 deletions src/ConditionAnalyzer/Analyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use BaoPham\DynamoDb\ComparisonOperator;
use BaoPham\DynamoDb\DynamoDbModel;
use BaoPham\DynamoDb\H;
use Illuminate\Support\Arr;

/**
* Class ConditionAnalyzer
Expand Down Expand Up @@ -71,7 +72,7 @@ public function isExactSearch()
}

foreach ($this->conditions as $condition) {
if (array_get($condition, 'type') !== ComparisonOperator::EQ) {
if (Arr::get($condition, 'type') !== ComparisonOperator::EQ) {
return false;
}
}
Expand Down Expand Up @@ -173,15 +174,15 @@ private function getIndex()
$index = null;

foreach ($this->model->getDynamoDbIndexKeys() as $name => $keysInfo) {
$conditionKeys = array_pluck($this->conditions, 'column');
$conditionKeys = Arr::pluck($this->conditions, 'column');
$keys = array_values($keysInfo);

if (count(array_intersect($conditionKeys, $keys)) === count($keys)) {
if (!isset($this->indexName) || $this->indexName === $name) {
$index = new Index(
$name,
array_get($keysInfo, 'hash'),
array_get($keysInfo, 'range')
Arr::get($keysInfo, 'hash'),
Arr::get($keysInfo, 'range')
);

break;
Expand Down
3 changes: 2 additions & 1 deletion src/DynamoDb/QueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use BadMethodCallException;
use BaoPham\DynamoDb\DynamoDbClientInterface;
use BaoPham\DynamoDb\RawDynamoDbQuery;
use Illuminate\Support\Str;

/**
* Class QueryBuilder
Expand Down Expand Up @@ -109,7 +110,7 @@ public function prepare(DynamoDbClient $client = null)
*/
public function __call($method, $parameters)
{
if (starts_with($method, 'set')) {
if (Str::startsWith($method, 'set')) {
$key = array_reverse(explode('set', $method, 2))[0];
$this->query[$key] = current($parameters);

Expand Down
3 changes: 2 additions & 1 deletion src/DynamoDbClientService.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Aws\DynamoDb\DynamoDbClient;
use Aws\DynamoDb\Marshaler;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Log;

class DynamoDbClientService implements DynamoDbClientInterface
Expand Down Expand Up @@ -43,7 +44,7 @@ public function getClient($connection = null)

$config = config("dynamodb.connections.$connection", []);
$config['version'] = '2012-08-10';
$config['debug'] = $this->getDebugOptions(array_get($config, 'debug'));
$config['debug'] = $this->getDebugOptions(Arr::get($config, 'debug'));

$client = new DynamoDbClient($config);

Expand Down
5 changes: 3 additions & 2 deletions src/DynamoDbModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Exception;
use DateTime;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;

/**
* Class DynamoDbModel.
Expand Down Expand Up @@ -183,7 +184,7 @@ public function saveAsync(array $options = [])
$savePromise = $this->newQuery()->saveAsync();

$savePromise->then(function ($result) use ($create, $options) {
if (array_get($result, '@metadata.statusCode') === 200) {
if (Arr::get($result, '@metadata.statusCode') === 200) {
$this->exists = true;
$this->wasRecentlyCreated = $create;
$this->fireModelEvent($create ? 'created' : 'updated', false);
Expand Down Expand Up @@ -446,7 +447,7 @@ public function getMarshaler()
public function __sleep()
{
return array_keys(
array_except(get_object_vars($this), ['marshaler', 'attributeFilter'])
Arr::except(get_object_vars($this), ['marshaler', 'attributeFilter'])
);
}

Expand Down
11 changes: 6 additions & 5 deletions src/DynamoDbQueryBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Database\Eloquent\Scope;
use Illuminate\Support\Arr;

class DynamoDbQueryBuilder
{
Expand Down Expand Up @@ -470,7 +471,7 @@ public function find($id, array $columns = [])

$item = $query->prepare($this->client)->getItem();

$item = array_get($item->toArray(), 'Item');
$item = Arr::get($item->toArray(), 'Item');

if (empty($item)) {
return null;
Expand Down Expand Up @@ -601,7 +602,7 @@ public function removeAttribute(...$attributes)
->prepare($this->client)
->updateItem();

$success = array_get($result, '@metadata.statusCode') === 200;
$success = Arr::get($result, '@metadata.statusCode') === 200;

if ($success) {
$this->model->setRawAttributes(DynamoDb::unmarshalItem($result->get('Attributes')));
Expand All @@ -618,7 +619,7 @@ public function delete()
->prepare($this->client)
->deleteItem();

return array_get($result->toArray(), '@metadata.statusCode') === 200;
return Arr::get($result->toArray(), '@metadata.statusCode') === 200;
}

public function deleteAsync()
Expand All @@ -638,7 +639,7 @@ public function save()
->prepare($this->client)
->putItem();

return array_get($result, '@metadata.statusCode') === 200;
return Arr::get($result, '@metadata.statusCode') === 200;
}

public function saveAsync()
Expand Down Expand Up @@ -710,7 +711,7 @@ protected function getAll(
$res = $this->client->query($raw->query);
}

$this->lastEvaluatedKey = array_get($res, 'LastEvaluatedKey');
$this->lastEvaluatedKey = Arr::get($res, 'LastEvaluatedKey');
$iterator = $res['Items'];
}

Expand Down
9 changes: 5 additions & 4 deletions src/Parsers/ConditionExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use BaoPham\DynamoDb\ComparisonOperator;
use BaoPham\DynamoDb\NotSupportedException;
use BaoPham\DynamoDb\Facades\DynamoDb;
use Illuminate\Support\Arr;

class ConditionExpression
{
Expand Down Expand Up @@ -70,9 +71,9 @@ public function parse($where)
$parsed = [];

foreach ($where as $condition) {
$boolean = array_get($condition, 'boolean');
$value = array_get($condition, 'value');
$type = array_get($condition, 'type');
$boolean = Arr::get($condition, 'boolean');
$value = Arr::get($condition, 'value');
$type = Arr::get($condition, 'type');

$prefix = '';

Expand All @@ -86,7 +87,7 @@ public function parse($where)
}

$parsed[] = $prefix . $this->parseCondition(
array_get($condition, 'column'),
Arr::get($condition, 'column'),
$type,
$value
);
Expand Down
3 changes: 2 additions & 1 deletion src/Parsers/KeyConditionExpression.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
namespace BaoPham\DynamoDb\Parsers;

use BaoPham\DynamoDb\ComparisonOperator;
use Illuminate\Support\Arr;

class KeyConditionExpression extends ConditionExpression
{
protected function getSupportedOperators()
{
return array_only(static::OPERATORS, [
return Arr::only(static::OPERATORS, [
ComparisonOperator::EQ,
ComparisonOperator::LE,
ComparisonOperator::LT,
Expand Down
Loading