-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
$this->view->render() debug #13046
Comments
Hmmm you might be right, i don't even see |
I'm not sure if this is how its intended to be used? I assign the params individually, I also select my view
or you can use you also don't need to return the view from the controller. After the method executions Phalcon automatically renders the view. |
-- |
So is your problem resolved? |
I guess, he just mention here we have some property and method which is actually just some garbage which does nothing. |
my problem resolved |
Fixed in the |
Just upgraded to 3.2.3, and hit a bug with this fix: $router->add('/test-page/{bar:[0-9]+}', ['controller' => 'MyController']); $this->view->setVar('bar', 'foo'); now returns the dispatcher's |
I guess there should be array_merge paras from dispatcher and viewParams then? |
Though it's weird, it happens already. |
It didn't happen in 3.2.2. So it's a breaking change in 3.2.3. The issue is that |
@Jurigag: the issue is not the array_merge, it's the fact that: It was indeed a bug, but the fix creates a behaviour that makes the 3.2.3 a 3.3.0... |
Yea tbh i don't see really a good way to fix it right now. This is beacause of automatic rendering which always is passing parameters. The only way i see is really to https://github.com/sergeyklay/cphalcon/blob/3f703832786c7fb7a420bcf31ea0953ba538591d/phalcon/mvc/view.zep#L432 add here argument like
Which will fix this. And use this reverse as true only when adding vars from dispatcher(autoamtic rendering) so it won't override params already set to view. |
Clearly, as it wasn't working before, we should drop the injection in https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/application.zep#L351 Then we'll think it through, perhaps by setting it when the view is created. @sergeyklay: can we please rollback this fix and release a new version? Should I open a new bug? |
Not a rollback, but just remove the injection here: I'm sending a patch right now. |
As i told, first happens your view setting(like vars), then automatic rendering from application. There is no really way to reverse this process. But i think what i proposed could be good enough like reverse array_merge when adding parameters from dispatcher. So only any additional parameters are added to view, ones set by us by setVars or setVar will be not replaced this way. |
@Jurigag the fact is the dispatcher's params were never read => we should ignore these, and that will keep this bug closed, but no breaking change. Then we can think of any other solution to inject dispatcher's params... even if it's useless I think. Setting a param in a |
Well maybe yea. I don't see any point of passing dispatcher params to view anyway to be honest. Those are diffrent things really. And since it wasn't working anyway we should just drop this |
Thanks for your input. I'm opening a new bug and a patch. |
in controller
but in view I can not get
$name
$age
https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/view.zep#L787-L789
I find this code
I thind that code should be
Details
3.2.2
)5.6
)The text was updated successfully, but these errors were encountered: