-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Refactor Generators #4055
Refactor Generators #4055
Conversation
This looks like a good move, but I will need to review it more thoroughly on desktop. Also looks like some static analysis failures, so maybe WIP? We would need to have this done before release in order to avoid breaking changes on the generator class names. |
ec762b6
to
1d110d6
Compare
Thanks @MGatner , and I'm working on it, I hope if i finish it today |
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.
Generally, I like the refactors made. I'll do a full review tomorrow but my initial concern is on programmatic calls. CLI::getOption()
will return nothing when the command is not called via cli, that is why we need to check array_key_exists on the $params. This way, the options can be tested via unit tests. So, please do not remove those array_key_exists checks already in place.
Another one is on the --force
option handling. This option is meant to allow overwriting files but you made it impossible to overwrite even if --force
is given. It is like you are offering something and then when they grab that you refuse to give that right away. I find it quite illogical.
1d110d6
to
472a807
Compare
Alright, then. I maybe got quite confused with that block. Please then re-include the access to |
472a807
to
cbae376
Compare
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.
These review comments are not yet exhaustive but my initial comments only. Most of the comments are on the proper programmatic call handling.
I guess the 360 minute testing was caused by an executed call to |
@paulbalandan Thanks for this helpful review, give me few hours to be in home and i'll fix all of this mistakes |
Nice work team! I came to see where this was at, I like seeing all the activity. |
7d27f64
to
e669f5c
Compare
|
e669f5c
to
020dc16
Compare
@mostafakhudair I ran the test locally one by one and indicated where looping happens. Seems to be related to the |
@sfadschm Thanks for your time to test this, but could you tell me why specially make:model looping |
020dc16
to
5a5876d
Compare
c85c09f
to
d40596e
Compare
Btw. what happened to the model table defaulting to pluralized class name? CodeIgniter4/system/Commands/Generators/CreateModel.php Lines 127 to 142 in 453af97
|
d40596e
to
b94f0e9
Compare
Test ran well on local machine, but still stucked at 6% in here |
Thats still |
I already fixed model and migrate prompt before i push changes |
0d8b2c3
to
f329f77
Compare
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 saw a lot of comments here. Some are on the deviation from the original logic of GeneratorCommand
, others on the design, while others is removing existing functionalities. I saw some changes removing existing functions even before GeneratorCommand
was existing, so technically that removal is a BC break for existing users. I'll have to put the BC break tag until those BCs are resolved.
Also, don't dismiss right away a comment without providing an explanation. If you do not agree, tell us so.
f329f77
to
b30463c
Compare
b30463c
to
8f88e9c
Compare
Refactor generators commands to match with standard commands with additional useful options
All generators extends
BaseCommand
usingGeneratorTrait
Fix Controller extends
PresenterController
methodsAuto generate Entity class on
make:model
with option-return entity
for example:
php spark make:model users -table users -return entity
will result
App\Models\Users
App\Entities\Users
Add suffix class name by prepend component name, with
--suffix
optionfor example:
php spark make:controller users
will result
App\Controllers\Users
php spark make:controller users
will result
App\Controllers\UsersController
Scaffold command removed for now and will be added in a separate PR later
Simplify code and clean unnecessary vars
userguide will be updated in a separated PR