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

Accessing security service in Model

I'm trying to figure out how to do a $this->security->hash(...) inside a function of my model, but the far I've get is FactoryDefault::getDefault()->getService("security"). Which is the small detail I skipped out?



6.9k
Accepted
answer

Resolving the DI inside of a non-injected class:

$this->getDi()->getShared('security')->hash(...);