How do i get access to the database via the model. I'm extending a class from model class which on initialize will set a property to the connection. This is my code:
    <?php
    use Phalcon\Mvc\Model;
    class BaseModel extends Model
    {
        protected $db;
        public function initialize()
        {
            $this->db = $this->getDi()->getShared('db');
        }
    }it works on a controller class but not here. Any help