Skip to content

Commit 0c2211e

Browse files
authored
Merge pull request #670 from datamweb/fix-shield-model
fix: add `parent::initialize()` for access the table name
2 parents 8fe4b86 + 4182fde commit 0c2211e

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/Commands/Generators/Views/usermodel.tpl.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ class {class} extends ShieldUserModel
1010
{
1111
protected function initialize(): void
1212
{
13+
parent::initialize();
14+
1315
$this->allowedFields = [
1416
...$this->allowedFields,
1517

tests/Commands/UserModelGeneratorTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function testGenerateUserModel(): void
9090
$this->assertStringContainsString('class UserModel extends ShieldUserModel', $contents);
9191
$this->assertStringContainsString('use CodeIgniter\Shield\Models\UserModel as ShieldUserModel;', $contents);
9292
$this->assertStringContainsString('protected function initialize(): void', $contents);
93+
$this->assertStringContainsString('parent::initialize();', $contents);
9394
}
9495

9596
public function testGenerateUserModelCustomNamespace(): void

0 commit comments

Comments
 (0)