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.

Phalcon 3 and mssql server

Hi, i would like upgrade my phalcon to 3.0 and php to 7.0, but in my app i need connect to MSSQL server :( In 2.0.x version i use lib https://github.com/ToNict/phalcon-sqlsrv/ but after upgrade to 3.0 i have error

Declaration of Phalcon\Db\Adapter\Pdo\Sqlsrv::connect($descriptor = NULL) should be compatible with Phalcon\Db\Adapter\Pdo::connect(array $descriptor = NULL)

in changelog i don't seen any changes for PDO so I'm a bit confused. I wroted to "ToNict" but i don't know when he/she anserw. Have anyone idea what was changed or what i schould do to run this stuff?

Regards

The class was changed as you see. You just need to add array before $descriptor in Phalcon\Db\Adapter\Pdo\Sqlsrv::connect. Perhaps do even more things. Phalcon don't really like mssql.



128
Accepted
answer
edited Aug '16

you can simply add array argument type hint at line 38 in Phalcon\Db\Adapter\Pdo\Sqlsrv.php like this

public function connect(array $descriptor = null)

it will be fine because we always pass array so type hinting won't matter



3.1k

Hi, thanks for anserw. That work :) Another problem is no support for sqlsrv in php7 ;)

https://github.com/Azure/msphpsql/releases/tag/4.1.0

This driver is official and contributors are from Microsoft.

Hi, thanks for anserw. That work :) Another problem is no support for sqlsrv in php7 ;)



3.1k

Yeap, but this is for Windows, but i have Debian...

well..they have supported ubuntu15 and 16 not sure if that'll work with debian or not....



3.1k

Hi I checked few things and I solved it.

all i described: https://github.com/ToNict/phalcon-sqlsrv/issues/5

Thanks for helping guys :)

On Debian/GNU, I'm using http://www.freetds.org and plain PHP PDO / dblib: http://php.net/manual/en/ref.pdo-dblib.connection.php

You just build ORM-like wrapper around it and voila.