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

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');`
   }