Skip to content

feat: add shield:model command for make custom UserModel - #491

Closed
datamweb wants to merge 16 commits into
codeigniter4:developfrom
datamweb:CLI-custom-user-model
Closed

feat: add shield:model command for make custom UserModel#491
datamweb wants to merge 16 commits into
codeigniter4:developfrom
datamweb:CLI-custom-user-model

Conversation

@datamweb

@datamwebdatamweb commented Oct 31, 2022

Copy link
Copy Markdown
Collaborator

This command helps to create custom user model.

  • php spark shield:model MyCustomUser
  • php spark shield:model MyCustomUser --force
  • php spark shield:model MyCustomUser --suffix
  • php spark shield:model MyCustomUser --namespace CodeIgniter\Shield

output

<?phpdeclare(strict_types=1);
namespaceApp\Models;
useCodeIgniter\Shield\Models\UserModel;
class MyCustomUser extends UserModel
{
protectedfunctioninitialize(): void
{
// Merge properties with parent$this->allowedFields = array_merge($this->allowedFields, [
// Add here your custom fields// 'first_name',
]);
}
} 

see: ##489 (comment)

@datamwebdatamweb added enhancement New feature or request tests needed Pull requests that need tests docs needed Pull requests needing documentation write-ups and/or revisions. labels Oct 31, 2022
@datamweb
datamweb marked this pull request as draft October 31, 2022 05:20
@datamweb

Copy link
Copy Markdown
CollaboratorAuthor

The name php spark shield:make doesn't seem right,
php spark shield:make name are received as class names, do you have any ideas?

Where to add documents? Do we need a new CLI file?

@paulbalandan

Copy link
Copy Markdown
Member

php spark shield:model?

@datamweb

Copy link
Copy Markdown
CollaboratorAuthor

php spark shield:model?

I think this is reasonable and good. do you all agree?

Comment threadtests/Commands/UserModelGeneratorTest.php Outdated
@datamwebdatamweb removed the tests needed Pull requests that need tests label Nov 2, 2022
@datamweb
datamwebforce-pushed the CLI-custom-user-model branch from 6e8fa2c to 92ba9d4CompareNovember 2, 2022 07:03
@datamwebdatamweb removed the docs needed Pull requests needing documentation write-ups and/or revisions. label Nov 2, 2022
@datamweb
datamweb marked this pull request as ready for review November 2, 2022 07:40
@datamwebdatamweb changed the title feat: add new CLI command For make custom UserModelfeat: add shield:model command for make custom UserModelNov 2, 2022
Comment threaddocs/concepts.md Outdated
Comment threaddocs/concepts.md Outdated
Comment threadsrc/Commands/Generators/UserModelGenerator.php Outdated
Comment threadsrc/Commands/Generators/Views/usermodel.tpl.php Outdated
Comment threadtests/Commands/UserModelGeneratorTest.php Outdated
Comment threadsrc/Commands/Generators/UserModelGenerator.php Outdated
Comment threadsrc/Commands/Generators/UserModelGenerator.php Outdated
datamweband others added 7 commits November 2, 2022 11:42
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>

@paulbalandanpaulbalandan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please git rebase -i so that all commits will be under your name and marked Verified.

Comment threaddocs/concepts.md Outdated
Comment on lines +74 to +77

if (is_file($filepath)) {
unlink($filepath);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to a $this->assertFileExist test. Deleting the file will be made in tearDown.

Comment threadtests/Commands/UserModelGeneratorTest.php Outdated
Comment threadtests/Commands/UserModelGeneratorTest.php Outdated
Comment threadsrc/Commands/Generators/Views/usermodel.tpl.php Outdated
datamweband others added 3 commits November 10, 2022 10:41
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
Co-authored-by: John Paul E. Balandan, CPA <paulbalandan@gmail.com>
@datamweb
datamweb marked this pull request as draft November 10, 2022 07:41
@datamweb
datamwebforce-pushed the CLI-custom-user-model branch from 3047309 to ee29840CompareNovember 10, 2022 18:59
@lonnieezell

Copy link
Copy Markdown
Member

@datamweb@paulbalandan Where does this PR stand? Other than resolving the conflicts is there anything left?

@paulbalandan

Copy link
Copy Markdown
Member

I'm not sure with @datamweb on the status.

@datamwebdatamweb added the stale Pull requests with conflicts label Dec 12, 2022
@datamweb

Copy link
Copy Markdown
CollaboratorAuthor

Other than resolving the conflicts is there anything left?

Change this to a $this->assertFileExist test. Deleting the file will be made in tearDown.
There is a small problem in the test. I will try to deal with this PR after the 2022-12-17.

It will be great if someone takes over before me.

@lonnieezell

Copy link
Copy Markdown
Member

Closing this one since another is in its place.

@datamweb
datamweb deleted the CLI-custom-user-model branch January 5, 2023 13:46
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or requeststalePull requests with conflicts

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@datamweb@paulbalandan@lonnieezell