Skip to content

Commit

Permalink
Merge branch '7.1' into 7.2
Browse files Browse the repository at this point in the history
* 7.1:
  fix CS
  Update deprecations baseline
  [Mailer][MailJet] Fix parameters for TrackClicks and TrackOpens
  [Doctrine][Messenger] Oracle sequences are suffixed with `_seq`
  drop existing schema if tests create it explicitly
  synchronize line numbers in deprecations baseline
  [HttpClient] Fix class requirement message
  Add integration test for RememberMe with pg connection
  fix: DoctrineTokenProvider not oracle compatible
  • Loading branch information
xabbuh committed Oct 18, 2024
2 parents a56f9af + b2f548c commit 533e664
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
17 changes: 17 additions & 0 deletions Tests/Transport/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -752,4 +752,21 @@ class_exists(SQLServerPlatform::class) && !class_exists(SQLServer2012Platform::c
];
}
}

public function testConfigureSchemaOracleSequenceNameSuffixed()
{
$driverConnection = $this->createMock(DBALConnection::class);
$driverConnection->method('getDatabasePlatform')->willReturn(new OraclePlatform());
$schema = new Schema();

$connection = new Connection(['table_name' => 'messenger_messages'], $driverConnection);
$connection->configureSchema($schema, $driverConnection, fn () => true);

$expectedSuffix = '_seq';
$sequences = $schema->getSequences();
$this->assertCount(1, $sequences);
$sequence = array_pop($sequences);
$sequenceNameSuffix = substr($sequence->getName(), -strlen($expectedSuffix));
$this->assertSame($expectedSuffix, $sequenceNameSuffix);
}
}
7 changes: 4 additions & 3 deletions Transport/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*/
class Connection implements ResetInterface
{
private const ORACLE_SEQUENCES_SUFFIX = '_seq';
protected const TABLE_OPTION_NAME = '_symfony_messenger_table_name';

protected const DEFAULT_OPTIONS = [
Expand Down Expand Up @@ -454,7 +455,7 @@ private function executeInsert(string $sql, array $parameters = [], array $types
throw new TransportException('no id was returned by PostgreSQL from RETURNING clause.');
}
} elseif ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) {
$sequenceName = 'seq_'.$this->configuration['table_name'];
$sequenceName = $this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX;

$this->driverConnection->executeStatement($sql, $parameters, $types);

Expand Down Expand Up @@ -525,9 +526,9 @@ private function addTableToSchema(Schema $schema): void

// We need to create a sequence for Oracle and set the id column to get the correct nextval
if ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) {
$idColumn->setDefault('seq_'.$this->configuration['table_name'].'.nextval');
$idColumn->setDefault($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX.'.nextval');

$schema->createSequence('seq_'.$this->configuration['table_name']);
$schema->createSequence($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX);
}
}

Expand Down

0 comments on commit 533e664

Please sign in to comment.