-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new command shield:extend #1141
base: develop
Are you sure you want to change the base?
feat: new command shield:extend #1141
Conversation
public function run(array $params) | ||
{ | ||
$this->replacer = new ContentReplacer(); | ||
$this->sourcePath = __DIR__ . '/../../examples/'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to have examples?
I think we should avoid maintaining both the original controller and the controller in Examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created an example to provide a simple way to create an extended controller because in some cases we need to customize the controller. I did not copy all the methods from the source, only some parts that most likely need to be modified.
This is quite helpful for novice users like me, if you guys do not agree with this way, feel free to close this PRs.
Also, please fix errors in GitHub Action checks, and add test code. |
Description
This PRs provide a new command
shield:extend
to easily extend any controller.The Command's Usage
The Command's Options
Example:
Example when the controller already exists:
Or we can use the full option as below:
this@PC playground % php spark shield:extend -i 3 -f CodeIgniter v4.5.3 Command Line Tool - Server Time: 2024-07-09 05:27:18 UTC+07:00 Created: APPPATH/Controllers/RegisterController.php After extending, don't forget to change the route. See https://shield.codeigniter.com/customization/route_config
Checklist: