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.

Access to a Dependency in a Model

Hi, i want to know if im doing this correctly, currently im using the following code:

$this->password = \Phalcon\DI::getDefault()->getSecurity()->hash($this->password);

Is it ok, or is there any other method?



491
Accepted
answer

$this->password = $this->getDI()->getSecurity()->hash($this->password);

Thanks man :)