-
-
Notifications
You must be signed in to change notification settings - Fork 81
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
base: 8.x
Are you sure you want to change the base?
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:
Additional details and impacted files@@ Coverage Diff @@
## 8.x #194 +/- ##
=======================================
Coverage 3.50% 3.50%
Complexity 607 607
=======================================
Files 85 85
Lines 2539 2539
=======================================
Hits 89 89
Misses 2450 2450 ☔ 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? |
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