Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

How to use cookies in models?

How to use cookies from models ? Cookies from controller work is normally but from models does not work, why?


$t = \Phalcon\Di::getDefault()->get("cookies");

$t->set("name etc ... ')...

After reading 3.0 notes and saying that $di is now in $this I wonder if it will be possible to use $this->session in models instead of $this->getDI()->getSession(). Need to upgrade and test next week, no time now :(

edited Aug '16

I'm guessing that you really didn't read 3.0 notes. It's saying that your service definition is bound to di(so functions are the methods in Phalcon\Di object, this is why you can use $this. Are your models are defined in di as service defnition ?