You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 8, 2020. It is now read-only.
Since AbstractTableGateway doesn't pass a second parameter, $statement will always be null. But calling the createStatement method of Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv without an argument throws the exception given above.
publicfunctioncreateStatement($sqlOrResource = null)
{
$statement = clone$this->statementPrototype;
if (is_string($sqlOrResource)) {
$statement->setSql($sqlOrResource);
if (!$this->connection->isConnected()) {
$this->connection->connect();
}
$statement->initialize($this->connection->getResource());
} elseif (is_resource($sqlOrResource)) {
$statement->initialize($sqlOrResource); // will check the resource type
} else {
thrownewException\InvalidArgumentException('createStatement() only accepts an SQL string or a Sqlsrv resource');
}
return$statement;
}
Performing a select using a TableGateway results in the following exception: 'createStatement() only accepts an SQL string or a Sqlsrv resource'
The executeSelect method of Zend\Db\TableGateway\AbstractTableGateway includes the following line:
Which calls the prepareStatementForSqlObject method of Zend\Db\Sql\Sql:
Since AbstractTableGateway doesn't pass a second parameter,
$statementwill always be null. But calling the createStatement method of Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv without an argument throws the exception given above.