Skip to content

Conversation

@gsteel
Copy link
Member

@gsteel gsteel commented May 29, 2025

In order to have a simple way to reset all state that has built up in view helpers / plugins, the plugin manager overrides Container::get to populate a list of stateful plugins that have been used during the rendering cycle.

Also re-writes "Advanced Usage", de-emphasising MVC related docs.

In order to have a simple way to reset all state that has built up in view helpers / plugins, the plugin manager overrides `Container::get` to populate a list of stateful plugins that have been used during the rendering cycle.

Also re-writes "Advanced Usage", de-emphasising MVC related docs.

Signed-off-by: George Steel <[email protected]>
@gsteel gsteel added this to the 3.0.0 milestone May 29, 2025
@gsteel gsteel requested a review from a team May 29, 2025 22:53
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my PoV, this is a very welcome addition. Would still want other opinions before proceeding with this design, though: in other environments I worked with, the entire container was being rebuilt (which is also a fine approach)

Comment on lines +14 to +16
* Resets the internal state built up in any view helpers so that further rendering cycles are not polluted
*/
public function resetState(): void;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very welcome addition 👍

@gsteel
Copy link
Member Author

gsteel commented May 30, 2025

My plan here is hopefully to drop "Rendering Strategies" and the ViewEvent stuff leaving just Laminas\View\View - This class will be repurposed so that it's the main entry point for rendering templates and it will be configured with things like which layout template to use, strict variables etc, the theory being that each call to View::render() will be a "complete" render, and internally, all state will be reset each time it is called.

Plugin Managers don't provide any way to reset/clear built services AFAIK, nor extract config, so that would need to implemented over there first if tearing down the container was the preferred route.

Copy link
Member

@weierophinney weierophinney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real code changes, but some doc changes.

But this was a primary reason why I moved away from laminas-view some time ago, so this will definitely be welcome!

gsteel and others added 2 commits May 30, 2025 15:21
Co-authored-by: Matthew Weier O'Phinney <[email protected]>
Signed-off-by: George Steel <[email protected]>
@gsteel gsteel requested a review from weierophinney May 30, 2025 14:26
@gsteel
Copy link
Member Author

gsteel commented Jun 2, 2025

Anyone have any objections if I merge this? Looks like all feedback is resolved

Copy link
Member

@froschdesign froschdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍🏻

@froschdesign
Copy link
Member

(I will recheck the documentation before the final release.)

@gsteel gsteel self-assigned this Jun 2, 2025
@gsteel gsteel merged commit e3a262d into laminas:3.0.x Jun 2, 2025
18 checks passed
@gsteel gsteel deleted the v3/helper-manager-interface branch June 2, 2025 20:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants