Skip to content
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

Add render() method to be called from controllers #399

Merged
merged 17 commits into from
Dec 23, 2020
Merged

Conversation

glensc
Copy link
Contributor

@glensc glensc commented Dec 22, 2020

Update each route to return a Response, or update $response. This is the pattern to be used and without magic.

This undoes the middleware for render:

  • b696f8e - Add base controller class & update tests. (7 years ago)
  • 550482d - Add middleware renderer. (7 years ago)
  • ebc69b3 - Convert run controller to use middleware. (7 years ago)
  • 8706219 - Move remaining controllers to middleware rendering. (7 years ago)

I believe the original purpose was to able to test controllers behavior, this problem is solved by fetching all() from view:

-        $result = $this->runs->templateVars();
+        $result = $this->view->all();

In fact, this brought up a problem that tests did not even use proper View. Tests used default \Slim\View not \Slim\Views\Twig and that View did not have template extensions present.

@glensc glensc self-assigned this Dec 22, 2020
@glensc glensc force-pushed the render-method branch 3 times, most recently from 5186957 to a50fa6f Compare December 22, 2020 22:56
@glensc glensc force-pushed the render-method branch 3 times, most recently from bfb1757 to 8a5febf Compare December 22, 2020 23:45
@glensc glensc force-pushed the render-method branch 2 times, most recently from 6a01acd to ab88068 Compare December 22, 2020 23:52
@glensc glensc marked this pull request as ready for review December 22, 2020 23:58
@glensc glensc merged commit 2c6db92 into master Dec 23, 2020
@glensc glensc deleted the render-method branch December 23, 2020 14:03
@glensc glensc added this to the Next milestone Dec 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant