vegas-cmf / core

Vegas CMF Core
MIT License
30 stars 7 forks source link

PostgreSQL support #31

Closed raxan closed 9 years ago

raxan commented 9 years ago

Hi

It's possible use PostgreSQL?

Thanks

szytko commented 9 years ago

Hi, follow this link http://vegas-cmf.github.io/1.0/guide/db/mysql.html and use Phalcon\Db\Adapter\Pdo\Postgresql instead of Phalcon\Db\Adapter\Pdo\Mysql

class DbServiceProvider implements ServiceProviderInterface
{
    const SERVICE_NAME = 'db';

    /**
     * {@inheritdoc}
     */
    public function register(DiInterface $di)
    {
            $arrayConfig = $di->get('config')->{self::SERVICE_NAME};
            $db = new \Phalcon\Db\Adapter\Pdo\Postgresql($arrayConfig);
            $db->setEventsManager($di->getShared('eventsManager')); // @see profiling section
            return $db;
    }

    public function getDependencies()
    {
        return array();
    }
} 

more info you can find here: http://docs.phalconphp.com/pt/latest/api/Phalcon_Db_Adapter_Pdo_Postgresql.html

hope this helps

raxan commented 9 years ago

WOW, seem easy.

Big Thanks!