You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had a bash at fixing this but it's Jelmered. The set_view method doesn't accept the view to which to set it, but merely forges a new View out of the string you set.
This means that the way you change view
$this->_view = 'new/view';
$this->set_view()
has already destroyed all data information on the original View object, so it can't be sent to the new one.
Options seem to me to be:
Change the way set_view() works so it works like any other mutator - this breaks BC but also allows changes from outside the class
Change the way set() works so that it stores the data on the ViewModel and passes it to the View at a later juncture - but this might require the user manually setting the data on the View object if they override, e.g., view().
The text was updated successfully, but these errors were encountered:
Just to check: you want to create a ViewModel with a view name string, then later change the View by a new one, but retain all data set on the original view?
It is from the inside yes - I suppose the way to do it in general would therefore be to have a method that changes the view filename from the outside. Is this valuable? Would it be better do this ad-hoc, for ViewModels that have rendering options?
This has been addressed in 2.0, where both View and Presenter are extensions of the generic DataContainer class, so data is stored separate from the View instance. It's only passed to the view when it's rendered.
Implementing this for 1.x is going to be quite a change.
I had a bash at fixing this but it's Jelmered. The
set_view
method doesn't accept the view to which to set it, but merely forges a new View out of the string you set.This means that the way you change view
has already destroyed all data information on the original View object, so it can't be sent to the new one.
Options seem to me to be:
set_view()
works so it works like any other mutator - this breaks BC but also allows changes from outside the classset()
works so that it stores the data on the ViewModel and passes it to the View at a later juncture - but this might require the user manually setting the data on the View object if they override, e.g.,view()
.The text was updated successfully, but these errors were encountered: