diff --git a/Dbal/Schema.php b/Dbal/Schema.php index 56ea9dc..ff9ee01 100644 --- a/Dbal/Schema.php +++ b/Dbal/Schema.php @@ -94,9 +94,9 @@ protected function addEntryTable() $table->addUniqueIndex(['class_id', 'object_identity_id', 'field_name', 'ace_order']); $table->addIndex(['class_id', 'object_identity_id', 'security_identity_id']); - $table->addForeignKeyConstraint($this->getTable($this->options['class_table_name']), ['class_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); - $table->addForeignKeyConstraint($this->getTable($this->options['oid_table_name']), ['object_identity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); - $table->addForeignKeyConstraint($this->getTable($this->options['sid_table_name']), ['security_identity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); + $table->addForeignKeyConstraint($this->getTable($this->options['class_table_name'])->getName(), ['class_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); + $table->addForeignKeyConstraint($this->getTable($this->options['oid_table_name'])->getName(), ['object_identity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); + $table->addForeignKeyConstraint($this->getTable($this->options['sid_table_name'])->getName(), ['security_identity_id'], ['id'], ['onDelete' => 'CASCADE', 'onUpdate' => 'CASCADE']); } /** @@ -116,7 +116,7 @@ protected function addObjectIdentitiesTable() $table->addUniqueIndex(['object_identifier', 'class_id']); $table->addIndex(['parent_object_identity_id']); - $table->addForeignKeyConstraint($table, ['parent_object_identity_id'], ['id']); + $table->addForeignKeyConstraint($table->getName(), ['parent_object_identity_id'], ['id']); } /** @@ -137,8 +137,8 @@ protected function addObjectIdentityAncestorsTable() // MS SQL Server does not support recursive cascading $action = 'NO ACTION'; } - $table->addForeignKeyConstraint($oidTable, ['object_identity_id'], ['id'], ['onDelete' => $action, 'onUpdate' => $action]); - $table->addForeignKeyConstraint($oidTable, ['ancestor_id'], ['id'], ['onDelete' => $action, 'onUpdate' => $action]); + $table->addForeignKeyConstraint($oidTable->getName(), ['object_identity_id'], ['id'], ['onDelete' => $action, 'onUpdate' => $action]); + $table->addForeignKeyConstraint($oidTable->getName(), ['ancestor_id'], ['id'], ['onDelete' => $action, 'onUpdate' => $action]); } /** diff --git a/Tests/Dbal/MutableAclProviderTest.php b/Tests/Dbal/MutableAclProviderTest.php index d29a0d9..368a399 100644 --- a/Tests/Dbal/MutableAclProviderTest.php +++ b/Tests/Dbal/MutableAclProviderTest.php @@ -263,7 +263,7 @@ public function testUpdateDoesNothingWhenThereAreNoChanges() ; $con ->expects($this->never()) - ->method('executeUpdate') + ->method('executeStatement') ; $provider = new MutableAclProvider($con, new PermissionGrantingStrategy(), []); @@ -536,7 +536,10 @@ protected function setUp(): void ], $configuration ); - $this->connection->setNestTransactionsWithSavepoints(true); + if (method_exists($configuration, 'setNestTransactionsWithSavepoints')) { + // DBAL < 4.0 + $this->connection->setNestTransactionsWithSavepoints(true); + } // import the schema $schema = new Schema($this->getOptions()); @@ -547,6 +550,7 @@ protected function setUp(): void protected function tearDown(): void { + $this->connection->close(); $this->connection = null; }