Skip to content

Commit 5352454

Browse files
committed
Support Laravel 12.x and PHP 8.4
1 parent 0e76904 commit 5352454

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

.github/workflows/php.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ jobs:
1010
strategy:
1111
matrix:
1212
include:
13+
- php: 8.4
14+
illuminate: ^12.0
1315
- php: 8.3
1416
illuminate: ^11.0
1517
- php: 8.2

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
"ci-test": "vendor/bin/phpunit --coverage-clover coverage.xml"
2121
},
2222
"require": {
23-
"php": "^7.3|^7.4|^8.0|^8.1|^8.2|^8.3",
24-
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
25-
"illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
26-
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
27-
"illuminate/hashing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
23+
"php": "^7.3|^7.4|^8.0|^8.1|^8.2|^8.3|^8.4",
24+
"illuminate/support": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
25+
"illuminate/container": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
26+
"illuminate/database": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
27+
"illuminate/hashing": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
2828
"aws/aws-sdk-php": "^3.0"
2929
},
3030
"require-dev": {
31-
"illuminate/auth": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0",
31+
"illuminate/auth": "^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0",
3232
"symfony/var-dumper": "^5.0|^6.0|^7.0",
3333
"vlucas/phpdotenv": "^4.1|^5.0",
3434
"mockery/mockery": "^1.3",

src/Kitar/Dynamodb/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ protected function getDefaultPostProcessor()
124124
*/
125125
protected function getDefaultQueryGrammar()
126126
{
127-
return $this->withTablePrefix(new Query\Grammar());
127+
return new Query\Grammar();
128128
}
129129

130130
/**

src/Kitar/Dynamodb/Query/Builder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,8 @@ public function newQuery()
577577
*/
578578
protected function process($query_method, $processor_method)
579579
{
580+
$table_name = $this->connection->getTablePrefix() . $this->from;
581+
580582
// Compile columns and wheres attributes.
581583
// These attributes needs to interact with ExpressionAttributes during compile,
582584
// so it need to run before compileExpressionAttributes.
@@ -590,13 +592,13 @@ protected function process($query_method, $processor_method)
590592
// Compile rest of attributes.
591593
$params = array_merge(
592594
$params,
593-
$this->grammar->compileTableName($this->from),
595+
$this->grammar->compileTableName($table_name),
594596
$this->grammar->compileIndexName($this->index),
595597
$this->grammar->compileKey($this->key),
596598
$this->grammar->compileItem($this->item),
597599
$this->grammar->compileUpdates($this->updates),
598-
$this->grammar->compileBatchGetRequestItems($this->from, $this->batch_get_keys),
599-
$this->grammar->compileBatchWriteRequestItems($this->from, $this->batch_write_request_items),
600+
$this->grammar->compileBatchGetRequestItems($table_name, $this->batch_get_keys),
601+
$this->grammar->compileBatchWriteRequestItems($table_name, $this->batch_write_request_items),
600602
$this->grammar->compileDynamodbLimit($this->limit),
601603
$this->grammar->compileScanIndexForward($this->scan_index_forward),
602604
$this->grammar->compileExclusiveStartKey($this->exclusive_start_key),

src/Kitar/Dynamodb/Query/Grammar.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct()
5555
public function compileTableName($table_name)
5656
{
5757
return [
58-
'TableName' => $this->tablePrefix . $table_name
58+
'TableName' => $table_name
5959
];
6060
}
6161

@@ -146,8 +146,6 @@ public function compileBatchGetRequestItems($table_name, $keys)
146146
return $marshaler->marshalItem($key);
147147
})->toArray();
148148

149-
$table_name = $this->tablePrefix . $table_name;
150-
151149
return [
152150
'RequestItems' => [
153151
$table_name => [
@@ -174,8 +172,6 @@ public function compileBatchWriteRequestItems($table_name, $request_items)
174172
});
175173
})->toArray();
176174

177-
$table_name = $this->tablePrefix . $table_name;
178-
179175
return [
180176
'RequestItems' => [
181177
$table_name => $marshaled_items,

tests/Query/BuilderTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,7 @@ public function it_can_process_scan_with_columns_specified()
11651165
public function it_can_process_process()
11661166
{
11671167
$connection = m::mock(Connection::class);
1168+
$connection->shouldReceive('getTablePrefix');
11681169
$connection->shouldReceive('scan')
11691170
->with(['TableName' => 'Forum'])
11701171
->andReturn(new Result(['Items' => []]))
@@ -1179,6 +1180,7 @@ public function it_can_process_process()
11791180
public function it_can_process_process_with_no_processor()
11801181
{
11811182
$connection = m::mock(Connection::class);
1183+
$connection->shouldReceive('getTablePrefix');
11821184
$connection->shouldReceive('putItem')
11831185
->with([
11841186
'TableName' => 'Thread',

0 commit comments

Comments
 (0)