aimeos wrote:Did you extend from an existing manager and replace parts of the code? This error happens if you acquire() a connection but don't call the appropriate release().
Hi,
Thank you very much for your guidance. You really helped me fix this issue. Actually, we had a custom Setup Task that was using deprecated method to get DBAL connection, i.e.
Code: Select all
$dbal = $this->getConnection( $rname )->getRawObject();
So, it was opening the connection but it was not closing it. So, like you said, there was no "release" called. So, I have changed "getConnection" method with "acquire" and then I also added "release" method at the end.
Code: Select all
/**
* Creates all required tables from schema if they don't exist
*
* @param array $files Associative list of resource names as keys and file paths as values
* @param boolean $clean True to remove left over columns or indexes, false to keep them untouched
*/
protected function setupSchema( array $files, $clean = false )
{
foreach( $files as $rname => $relpath )
{
$this->msg( 'Using schema from ' . basename( $relpath ), 1 ); $this->status( '' );
// "getConnection" method is deprecated.
// $dbal = $this->getConnection( $rname )->getRawObject();
// Using "acquire" method instead of "getConnection."
$conn = $this->acquire();
$dbal = $conn->getRawObject();
if( !( $dbal instanceof \Doctrine\DBAL\Connection ) ) {
throw new \Aimeos\MW\Setup\Exception( 'Not a DBAL connection' );
}
$dbalManager = $dbal->getSchemaManager();
$platform = $dbal->getDatabasePlatform();
$schema = $this->getSchema( $rname );
foreach( $this->getSchemaObjects( 'table', $relpath ) as $name => $dbalschema )
{
$this->msg( sprintf( 'Checking table "%1$s": ', $name ), 2 );
$table = $dbalManager->listTableDetails( $name );
$tables = ( $table->getColumns() !== [] ? array( $table ) : [] );
$tableSchema = new \Doctrine\DBAL\Schema\Schema( $tables );
$schemaDiff = \Doctrine\DBAL\Schema\Comparator::compareSchemas( $tableSchema, $dbalschema );
$stmts = $this->remove( $this->exclude( $schemaDiff, $relpath ), $clean )->toSaveSql( $platform );
$this->executeList( $stmts, $rname );
$this->status( 'done' );
}
if( $schema->supports( $schema::HAS_SEQUENCES ) )
{
$sequences = $dbalManager->listSequences();
foreach( $this->getSchemaObjects( 'sequence', $relpath ) as $name => $dbalschema )
{
$this->msg( sprintf( 'Checking sequence "%1$s": ', $name ), 2 );
$seqSchema = new \Doctrine\DBAL\Schema\Schema( [], $sequences );
$schemaDiff = \Doctrine\DBAL\Schema\Comparator::compareSchemas( $seqSchema, $dbalschema );
$stmts = $this->remove( $schemaDiff, $clean )->toSaveSql( $platform );
$this->executeList( $stmts, $rname );
$this->status( 'done' );
}
}
// Release DBAL connection
$this->release($conn);
}
}
So, once again thank you very much for your help!
But there is one thing that I need to point out. You guys are making big changes in minor revision updates. Since I have updated to Aimeos 2018.10.*, this is my third (3rd) time that I am dealing with either deprecated code or extra code. I like product updates but please keep them simple and backward compatible, especially if, release is not something major or at-least change update version to something significant, which block composer from updating packages.
Thanks!