We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

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 \Phalcon\Mvc\Model::setConnectionService() ??

How to use \Phalcon\Mvc\Model::setConnectionService() ??
I need an example. Thanks!!



4.6k
Accepted
answer
edited May '15

In models you can set connection string by.

public function initialize()
    {
       // By default "db" is choose for phalcon, you may specify other connection in your`
        $this->setConnectionService('dbCms');`
    }

Thank you.

In models you can set connection string by.

public function initialize()
   {
      // By default "db" is choose for phalcon, you may specify other connection in your`
       $this->setConnectionService('dbCms');`
   }