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.

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.5k
Accepted
answer

Resolving the DI inside of a non-injected class:

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