Skip to content

Commit 2acd4d0

Browse files
author
李强
committed
fix: Compatible with thinkorm4.0
1 parent b068fb4 commit 2acd4d0

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

.github/workflows/phpunit.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ jobs:
2020
fail-fast: true
2121
matrix:
2222
php: [ 8.0, 8.1, 8.2, 8.3, 8.4 ]
23+
thinkphp: [ "~8.0.3", "^8.1"]
2324

24-
name: PHP${{ matrix.php }}
25+
name: ThinkPHP${{ matrix.thinkphp }}-PHP${{ matrix.php }}
2526

2627
steps:
2728
- name: Checkout code
@@ -42,13 +43,16 @@ jobs:
4243
uses: actions/cache@v3
4344
with:
4445
path: vendor
45-
key: ${{ runner.os }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
46+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }}-${{ hashFiles('**/composer.lock') }}
4647
restore-keys: |
47-
${{ runner.os }}-${{ matrix.php }}
48+
${{ runner.os }}-${{ matrix.php }}-${{ matrix.thinkphp }}
4849
4950
- name: Install dependencies
5051
if: steps.composer-cache.outputs.cache-hit != 'true'
5152
run: composer install --prefer-dist --no-progress --no-suggest
53+
run: |
54+
composer require topthink/framework:${{ matrix.thinkphp }} --no-update --no-interaction
55+
composer install --prefer-dist --no-progress --no-suggest
5256
5357
- name: Run test suite
5458
run: ./vendor/bin/phpunit

src/model/Rule.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
class Rule extends Model implements Arrayable
1313
{
1414
use Configurable;
15+
16+
protected $name;
17+
18+
// 设置当前模型对应的完整数据表名称
19+
protected $table;
20+
21+
// 设置当前模型的数据库连接
22+
protected $connection;
23+
1524
/**
1625
* 设置字段信息
1726
*
@@ -37,6 +46,7 @@ public function __construct(array|object $data = [])
3746
$this->connection = $this->config('database.connection') ?: '';
3847
$this->table = $this->config('database.rules_table');
3948
$this->name = $this->config('database.rules_name');
49+
4050
parent::__construct($data);
4151
}
4252
}

0 commit comments

Comments
 (0)