Skip to content

Commit

Permalink
Merge pull request #670 from datamweb/fix-shield-model
Browse files Browse the repository at this point in the history
fix: add `parent::initialize()` for access the table name
  • Loading branch information
datamweb authored Mar 14, 2023
2 parents 8fe4b86 + 4182fde commit 0c2211e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Commands/Generators/Views/usermodel.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ class {class} extends ShieldUserModel
{
protected function initialize(): void
{
parent::initialize();

$this->allowedFields = [
...$this->allowedFields,

Expand Down
1 change: 1 addition & 0 deletions tests/Commands/UserModelGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function testGenerateUserModel(): void
$this->assertStringContainsString('class UserModel extends ShieldUserModel', $contents);
$this->assertStringContainsString('use CodeIgniter\Shield\Models\UserModel as ShieldUserModel;', $contents);
$this->assertStringContainsString('protected function initialize(): void', $contents);
$this->assertStringContainsString('parent::initialize();', $contents);
}

public function testGenerateUserModelCustomNamespace(): void
Expand Down

0 comments on commit 0c2211e

Please sign in to comment.