-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
fix: controller generator #194
Conversation
Works for plural modelling too: public function __construct(
private readonly ListDistrictsAction $action
) {
}
public function __invoke(ListDistrictsRequest $request): array
{
$districts = $this->action->run($request);
return $this->transform($districts, DistrictTransformer::class);
} |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.x #194 +/- ##
==========================================
- Coverage 4.26% 4.26% -0.01%
Complexity 668 668
==========================================
Files 92 92
Lines 2742 2746 +4
==========================================
Hits 117 117
- Misses 2625 2629 +4 ☔ View full report in Codecov by Sentry. |
@innoflash Thank you for this! 💪 |
Sure, take your time. I may have found a couple more things I think I can help solve on the framework. |
@Mohammad-Alavi where is the test file for the controller generation so I can add a test for this addition? |
673a5e5
to
db9a9cb
Compare
Description
This PR aims to solve the issue I mentioned on #193
The controller generator seems to be misbehaving and we eventually have a need to go fix the generated code.
Short version is controllers are built with the wrong model.
Type of change
I simply added a
model
option to the inputs.Updated command is:
php artisan apiato:generate:controller --container Locations --model District
The model can also be requested for if one isnt provided in the command
The generated file has this code:
This now makes use of the desired model in this container