Result does not implement ResultInterface::getQueryResult() — fatal against current php-db/phpdb 0.6.x-dev #12
Description
Summary
Pgsql\Result no longer satisfies PhpDb\Adapter\Driver\ResultInterface. php-db/phpdb#172 added getQueryResult() to the interface (commit 6a14886), and this package does not implement it, so loading the class is a fatal:
Fatal error: Class PhpDb\Pgsql\Result contains 1 abstract method and must therefore be
declared abstract or implement the remaining methods
(PhpDb\Adapter\Driver\ResultInterface::getQueryResult) in src/Result.php on line 17
This happens before any test runs, so composer update followed by composer test fails outright.
The added signature is:
public function getQueryResult(?ResultSetInterface $resultPrototype = null): ResultSetInterface;It replaces the clone/initialize logic that previously lived in Adapter.
Proposed change
Implement the method on Pgsql\Result, following Adapter\Driver\Pdo\Result upstream:
#[Override]
public function getQueryResult(?ResultSetInterface $resultPrototype = null): ResultSetInterface
{
if (! $this->isQueryResult()) {
throw new Exception\RuntimeException(
'Cannot produce a query result set from a result that is not a query result;'
. ' check isQueryResult() first',
);
}
$resultPrototype ??= new ResultSet();
$resultSet = clone $resultPrototype;
$resultSet->initialize($this);
return $resultSet;
}isQueryResult() already exists here as pg_num_fields($this->resource) > 0, so the guard works as-is. Needs coverage for both branches.
Notes
#11 pins composer.lock to the older php-db/phpdb reference (81844a5) to avoid the fatal, which is a stopgap: the latest legs of the new matrix resolve 0.6.x-dev fresh and will fail, and the lock cannot move forward until this is fixed.
phpdb-mysql has no getQueryResult() either and its lock is pinned to an older reference again (e037464), so the same break is likely waiting there.
Activity