I'm trying to use Zend TableGateway
as a stand alone component with my app (not ZF2).
Below is a simple test script to just fetch some rows but I get the error
Uncaught exception 'Zend\Db\Adapter\Exception\RuntimeException' with message 'Row count is not available in unbuffered result sets.' in /var/www/shared-views-slim/vendor/zendframework/zend-db/Zend/Db/Adapter/Driver/Mysqli/Result.php:324
Below is my code:
/**
* This makes our life easier when dealing with paths. Everything is relative
* to the application root now.
*/
chdir(dirname(__DIR__));
// require composer autoloader for loading classes
require 'vendor/autoload.php';
// testing
$adapter = new Zend\Db\Adapter\Adapter(array(
'driver' => 'Mysqli',
'database' => 'budget_development',
'username' => 'root',
'password' => 'mypasswd'
));
use Zend\Db\TableGateway\TableGateway;
$accountsTable = new TableGateway('accounts', $adapter);
// search for at most 2 artists who's name starts with Brit, ascending
$rowset = $accountsTable->select();
var_dump($rowset);
Does anyone know how I can fix this? I don't really understand what it needs me to do.