We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Deprecated: Function Phalcon\Mvc\View::getParams() is deprecated

Hi Guys, I upgrade my php to PHP 7.2 with phalcon 3.3, someone could you help me with this warning? thanks

edited Apr '18

In this document : https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/view.zep

I see on line 497 : "@deprecated Will be removed in 4.0.0" It's a documentation comment, about the getParams function

It's a warning that tells you "Watch it, in an upcoming version you code will break because the function will no longer exist"

So, I changed to getParamsToView and works fine now my code, but I'm not sure it's correct. Thanks any reply

Hi Stéphane, thanks for your reply, but, I replace for what? Do you know how to replace? thanks

In this document : https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/view.zep

I see on line 497 : "@deprecated Will be removed in 4.0.0" It's a documentation comment, about the getParams function

It's a warning that tells you "Watch it, in an upcoming version you code will break because the function will no longer exist"



2.0k
Accepted
answer
edited Apr '18

Here : (https://olddocs.phalcon.io/en/latest/api/Phalcon_Mvc_View.html) [https://olddocs.phalcon.io/en/latest/api/Phalcon_Mvc_View.html] From the docs, they don't seem to do the same thing:

public getParamsToView ()

Returns parameters to views

Whereas:

public getParams ()

Gets extra parameters of the action rendered

The idea I would come with would be to use the dispatcher's getParams() result as a view's variable in the action:

$this->view->params = $this->dispatcher->getParams()

Thanks man. I changed to getParamsToView and works fine. Thank you very much. See you

As i remember getParams in view was not used anywhere in framework, i think it wasn't even ever set, that's why it's deprecated.