-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
RFC: Introduce a new package to decouple View from MVC #123
Comments
I'd focus this on just the bits of laminas-view that you feel are specific to the MVC:
The next few pieces are related, and ostensibly MVC-specific:
The reason I say ostensibly is because they deal with nested view models and how to render them, and how to select a rendering strategy. The feature exists to allow cobbling together content from a variety of different services, but then rendering it under a single view. It does a depth-first rendering, with each child capturing to a named variable in the parent model; this allows the parent then to use and/or manipulate that content when being rendered. Because each child can use a different rendering strategy, it also means that you could have, for instance, one child that uses, say, a Twig-based renderer, another that uses a Blad-based renderer, another using a Mustache-based renderer... but then use a laminas-view template to put all that content together. I could potentially even render to JSON in several children, and then consume the JSON in the parent (e.g., looping over objects and rendering them to HTML). The part I question is if this is something specific to the MVC, or if it's a capability/feature of laminas-view that stands alone. As for the navigation and fee parts of laminas-view:
|
I didn't realise that it was possible to use different rendering strategies per child model - having looked up the relevant tests, this makes sense as not necessarily MVC specific. Ultimately, the various rendering strategies implement MVC Specific View HelpersThe list of helpers relevant here is quite short:
Navigation helper tests do a lot of MVC scaffolding but the purpose of this is currently unclear to me - it's very possible this could be removed with the suggested |
The entire functionality for feeds in laminas-view can be completely reduced to a class for creating a response, as it exists in laminas-diactoros.
This can be clearly separated from the MVC part. I will help here and I already have something in the pipeline. |
Yes - this one is already in laminas/laminas-mvc-plugin-flashmessenger. Since it relies on laminas-session and laminas-mvc both (it provides a controller plugin for laminas-mvc and view helpers for laminas-session), it's a "bridge" component.
The I guess what we'd need to determine is if this ability to render trees (represented by Off the cuff:
In laminas-mvc, we'd add the new package as a dependency, and wire the This would reduce the number of dependencies we'd need for v3 and retain the tree rendering. |
@gsteel |
Yes, I think so - further conversation. can be moved to https://github.com/laminas/laminas-mvc-view |
laminas-view
is currently coupled tolaminas-mvc
.As part of the effort to evolve and improve
laminas-view
, it would be useful to extract the code and features that are only relevant tolaminas-mvc
into a separate package named something likelaminas-mvc-view
in a similar vein tomezzio-laminasviewrenderer
with the namespaceLaminas\Mvc\View
.I have made a start on the package at gsteel/laminas-mvc-view.
Currently, this package contains
ServerUrl
andUrl
view helpers that provide BC with their counterparts inlaminas-view
. The goal would be to eventually move/replace all of the MVC-specific functionality in this package:ViewEvent
and the mainView
class/entrypointRenderingStrategy
frameworkOnce the package has a stable release, the plan would be to deprecate all the relevant classes in
laminas-view
in a minor release of the2.x
series, removing them in3.0
.A minor release of
laminas-mvc
itself might be of benefit as there is opportunity to move code in theLaminas\Mvc\View
namespace to the proposed package.Whilst this RFC is only relevant to the MVC related code, there are further opportunities to de-couple
laminas-view
fromlaminas-navigation
andlaminas-feed
.I believe that as navigation in inherently "view related", it would be best to move all of the navigation related helpers to the navigation component making view a dependency of navigation.
The Feed renderer and rendering strategy might be co-located with the proposed package, moved to a standalone package or to
laminas-feed
.References:
laminas-view
laminas-view#149The text was updated successfully, but these errors were encountered: