ypnos-web / cakephp-datatables

CakePHP3 Plugin for DataTables plug-in for jQuery
MIT License
27 stars 24 forks source link

v2.0 incompatible with Cake v3.3 because of use of `Cake\ORM\Table::getConnection()` #51

Closed florentpoujol closed 6 years ago

florentpoujol commented 6 years ago

Hello and thanks for this lib, which we make a good use of at my company.

We still use CakePHP v3.3, so I am updating to you v2.0, however, line 296 of DataTablesComponent throws an exception, because you use Cake\ORM\Table::getConnection(), which was only introduced in Cake v3.4...
Line 296 is just this one : if ($this->_table->getConnection()->getDriver() instanceof Postgres) {

For now I just commented this piece of code since we don't use Postgres, but should we switch v1.0 instead or do you consider this a bug on your end that you will fix ?

Thanks for your time !

ypnos-web commented 6 years ago

Hello,

yes I consider this a bug. It would be of great help if you could check if this line works for you:

if ($this->_table->connection()->driver() instanceof Postgres) {

And then if you could do a pull request on 2.0 which replaces the line.

florentpoujol commented 6 years ago

It does work. :D

From their documentation, Cake\ORM\Table::connection() and Cake\Database\Connection::driver() exists since Cake v3.0.

I will do the PR later, but today.

ypnos-web commented 6 years ago

Fixed in 221f478