Skip to content

Commit 4182fde

Browse files
committed
fix: add parent::initialize() for access the table name
1 parent 8fe4b86 commit 4182fde

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)