Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/doctrine-messenger
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v7.1.6
Choose a base ref
...
head repository: symfony/doctrine-messenger
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v7.2.0
Choose a head ref
  • 13 commits
  • 6 files changed
  • 7 contributors

Commits on Jun 20, 2024

  1. Prefix all sprintf() calls

    derrabus committed Jun 20, 2024
    Copy the full SHA
    2618f36 View commit details

Commits on Jun 24, 2024

  1. chore: CS fixes

    keradus authored and nicolas-grekas committed Jun 24, 2024
    Copy the full SHA
    43866a5 View commit details

Commits on Jul 6, 2024

  1. Update .gitattributes

    fabpot committed Jul 6, 2024
    Copy the full SHA
    eb0c0f8 View commit details

Commits on Aug 6, 2024

  1. Code style change in @PER-CS2.0 affecting @Symfony (parentheses f…

    …or anonymous classes)
    bonroyage authored and derrabus committed Aug 6, 2024
    Copy the full SHA
    0dd8b0c View commit details

Commits on Aug 8, 2024

  1. Copy the full SHA
    fa29121 View commit details

Commits on Aug 12, 2024

  1. minor #57868 Remove useless code (alexandre-daubois)

    This PR was merged into the 7.2 branch.
    
    Discussion
    ----------
    
    Remove useless code
    
    | Q             | A
    | ------------- | ---
    | Branch?       | 7.2
    | Bug fix?      | no
    | New feature?  | no
    | Deprecations? | no
    | Issues        | -
    | License       | MIT
    
    I went through the remaining components and bundles, following my last PRs of this kind.
    
    Commits
    -------
    
    58941cec67 Remove useless code
    nicolas-grekas committed Aug 12, 2024
    Copy the full SHA
    6b3d6c6 View commit details

Commits on Aug 22, 2024

  1. Merge branch '7.1' into 7.2

    * 7.1:
      fix tests
      fix tests
      [DependencyInjection] Add tests for repeating `#[Autoconfigure]` attributes
      [DependencyInjection] Fix handling of repeated `#[Autoconfigure]` attributes
      update from Postgres 10 to 16
      [SecurityBundle] Make security schema deterministic
      [Translations][Core] Fix security Italian translation.
      clean up PHP version checks
      Support the `unique_proxy_open` event
    xabbuh committed Aug 22, 2024
    Copy the full SHA
    b70474b View commit details

Commits on Aug 30, 2024

  1. Merge branch '7.1' into 7.2

    * 7.1:
      fix test to be compatible with DBAL 4.2
    xabbuh committed Aug 30, 2024
    Copy the full SHA
    80de123 View commit details

Commits on Sep 20, 2024

  1. Merge branch '7.1' into 7.2

    * 7.1:
      Fix named arguments in data providers
      Make more data providers static
      fix merge
      Mutate remaining data providers to static ones
    derrabus committed Sep 20, 2024
    Copy the full SHA
    e83a6c9 View commit details

Commits on Sep 25, 2024

  1. Merge branch '7.1' into 7.2

    * 7.1:
      Add PR template and auto-close PR on subtree split repositories
    nicolas-grekas committed Sep 25, 2024
    Copy the full SHA
    2f76448 View commit details

Commits on Oct 2, 2024

  1. Copy the full SHA
    82ede3b View commit details

Commits on Oct 9, 2024

  1. Merge branch '7.1' into 7.2

    * 7.1:
      [Form] Remove unnecessary imports
      minor #58472 CS: clean some whitespaces/indentation (keradus)
      Fix newline
      harden test to not depend on the system's configured default timezone
      [Form] Support intl.use_exceptions/error_level in NumberToLocalizedStringTransformer
      [Doctrine][Messenger] Use common sequence name to get id from Oracle
      [ExpressionLanguage] Add missing test case for `Lexer`
      [FrameworkBundle] Fix passing request_stack to session.listener
      ensure session storages are opened in tests before destroying them
      [Serializer] Fix `ObjectNormalizer` gives warnings on normalizing with public static property
      [HttpKernel] Correctly merge `max-age`/`s-maxage` and `Expires` headers
      [Security][Validator] Check translations for Czech
      [Security] Fix serialized object representation in tests
      [DoctrineBridge] Fix risky test warnings
      [Serializer] Catch `NotNormalizableValueException` for variadic parameters
    xabbuh committed Oct 9, 2024
    Copy the full SHA
    a56f9af View commit details

Commits on Oct 18, 2024

  1. Merge branch '7.1' into 7.2

    * 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
    xabbuh committed Oct 18, 2024
    Copy the full SHA
    533e664 View commit details
5 changes: 3 additions & 2 deletions Tests/Transport/ConnectionTest.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport;

use Doctrine\DBAL\Configuration;
use Doctrine\DBAL\Connection as DBALConnection;
use Doctrine\DBAL\Exception as DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
@@ -308,7 +309,7 @@ private function getDBALConnectionMock()
$platform->method('getWriteLockSQL')->willReturn('FOR UPDATE SKIP LOCKED');
}

$configuration = $this->createMock(\Doctrine\DBAL\Configuration::class);
$configuration = $this->createMock(Configuration::class);
$driverConnection->method('getDatabasePlatform')->willReturn($platform);
$driverConnection->method('getConfiguration')->willReturn($configuration);

@@ -647,7 +648,7 @@ class_exists(SQLServerPlatform::class) && !class_exists(SQLServer2012Platform::c
if (!method_exists(QueryBuilder::class, 'forUpdate')) {
yield 'Oracle & DBAL<3.8' => [
new OraclePlatform(),
sprintf('SELECT w.id AS "id", w.body AS "body", w.headers AS "headers", w.queue_name AS "queue_name", w.created_at AS "created_at", w.available_at AS "available_at", w.delivered_at AS "delivered_at" FROM messenger_messages w WHERE w.id IN (SELECT a.id FROM (SELECT m.id FROM messenger_messages m WHERE (m.queue_name = ?) AND (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) ORDER BY available_at ASC) a WHERE ROWNUM <= 1) FOR UPDATE%s', method_exists(QueryBuilder::class, 'forUpdate') ? ' SKIP LOCKED' : ''),
\sprintf('SELECT w.id AS "id", w.body AS "body", w.headers AS "headers", w.queue_name AS "queue_name", w.created_at AS "created_at", w.available_at AS "available_at", w.delivered_at AS "delivered_at" FROM messenger_messages w WHERE w.id IN (SELECT a.id FROM (SELECT m.id FROM messenger_messages m WHERE (m.queue_name = ?) AND (m.delivered_at is null OR m.delivered_at < ?) AND (m.available_at <= ?) ORDER BY available_at ASC) a WHERE ROWNUM <= 1) FOR UPDATE%s', method_exists(QueryBuilder::class, 'forUpdate') ? ' SKIP LOCKED' : ''),
];
} elseif (class_exists(MySQL57Platform::class)) {
yield 'Oracle & 3.8<=DBAL<4' => [
4 changes: 1 addition & 3 deletions Tests/Transport/DoctrineReceiverTest.php
Original file line number Diff line number Diff line change
@@ -314,10 +314,8 @@ private function createDoctrineEnvelope(): array

private function createSerializer(): Serializer
{
$serializer = new Serializer(
return new Serializer(
new SerializerComponent\Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()])
);

return $serializer;
}
}
15 changes: 8 additions & 7 deletions Tests/Transport/PostgreSqlConnectionTest.php
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@

namespace Symfony\Component\Messenger\Bridge\Doctrine\Tests\Transport;

use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Driver\Result as DriverResult;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Query\QueryBuilder;
@@ -29,7 +30,7 @@ public function testSerialize()
$this->expectException(\BadMethodCallException::class);
$this->expectExceptionMessage('Cannot serialize '.PostgreSqlConnection::class);

$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);

$connection = new PostgreSqlConnection([], $driverConnection);
@@ -41,7 +42,7 @@ public function testUnserialize()
$this->expectException(\BadMethodCallException::class);
$this->expectExceptionMessage('Cannot unserialize '.PostgreSqlConnection::class);

$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);

$connection = new PostgreSqlConnection([], $driverConnection);
@@ -50,7 +51,7 @@ public function testUnserialize()

public function testListenOnConnection()
{
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);

$driverConnection
@@ -63,7 +64,7 @@ public function testListenOnConnection()
->method('createQueryBuilder')
->willReturn(new QueryBuilder($driverConnection));

$wrappedConnection = new class() {
$wrappedConnection = new class {
private int $notifyCalls = 0;

public function pgsqlGetNotify()
@@ -103,7 +104,7 @@ public function countNotifyCalls()

public function testGetExtraSetupSql()
{
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);
$connection = new PostgreSqlConnection(['table_name' => 'queue_table'], $driverConnection);

@@ -120,7 +121,7 @@ public function testGetExtraSetupSql()

public function testTransformTableNameWithSchemaToValidProcedureName()
{
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);
$connection = new PostgreSqlConnection(['table_name' => 'schema.queue_table'], $driverConnection);

@@ -134,7 +135,7 @@ public function testTransformTableNameWithSchemaToValidProcedureName()

public function testGetExtraSetupSqlWrongTable()
{
$driverConnection = $this->createMock(\Doctrine\DBAL\Connection::class);
$driverConnection = $this->createMock(Connection::class);
$driverConnection->method('executeStatement')->willReturn(1);
$connection = new PostgreSqlConnection(['table_name' => 'queue_table'], $driverConnection);

16 changes: 8 additions & 8 deletions Transport/Connection.php
Original file line number Diff line number Diff line change
@@ -104,13 +104,13 @@ public static function buildConfiguration(#[\SensitiveParameter] string $dsn, ar
// check for extra keys in options
$optionsExtraKeys = array_diff(array_keys($options), array_keys(static::DEFAULT_OPTIONS));
if (0 < \count($optionsExtraKeys)) {
throw new InvalidArgumentException(sprintf('Unknown option found: [%s]. Allowed options are [%s].', implode(', ', $optionsExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS))));
throw new InvalidArgumentException(\sprintf('Unknown option found: [%s]. Allowed options are [%s].', implode(', ', $optionsExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS))));
}

// check for extra keys in options
$queryExtraKeys = array_diff(array_keys($query), array_keys(static::DEFAULT_OPTIONS));
if (0 < \count($queryExtraKeys)) {
throw new InvalidArgumentException(sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s].', implode(', ', $queryExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS))));
throw new InvalidArgumentException(\sprintf('Unknown option found in DSN: [%s]. Allowed options are [%s].', implode(', ', $queryExtraKeys), implode(', ', array_keys(static::DEFAULT_OPTIONS))));
}

return $configuration;
@@ -126,7 +126,7 @@ public static function buildConfiguration(#[\SensitiveParameter] string $dsn, ar
public function send(string $body, array $headers, int $delay = 0): string
{
$now = new \DateTimeImmutable('UTC');
$availableAt = $now->modify(sprintf('%+d seconds', $delay / 1000));
$availableAt = $now->modify(\sprintf('%+d seconds', $delay / 1000));

$queryBuilder = $this->driverConnection->createQueryBuilder()
->insert($this->configuration['table_name'])
@@ -194,11 +194,11 @@ public function get(): ?array
if (method_exists(QueryBuilder::class, 'forUpdate')) {
$sql = $this->addLockMode($query, $sql);
} else {
if (preg_match('/FROM (.+) WHERE/', (string) $sql, $matches)) {
if (preg_match('/FROM (.+) WHERE/', $sql, $matches)) {
$fromClause = $matches[1];
$sql = str_replace(
sprintf('FROM %s WHERE', $fromClause),
sprintf('FROM %s WHERE', $this->driverConnection->getDatabasePlatform()->appendLockHint($fromClause, LockMode::PESSIMISTIC_WRITE)),
\sprintf('FROM %s WHERE', $fromClause),
\sprintf('FROM %s WHERE', $this->driverConnection->getDatabasePlatform()->appendLockHint($fromClause, LockMode::PESSIMISTIC_WRITE)),
$sql
);
}
@@ -296,7 +296,7 @@ public function setup(): void
}

if (!\is_string($tableName)) {
throw new \TypeError(sprintf('The table name must be an instance of "%s" or a string ("%s" given).', AbstractAsset::class, get_debug_type($tableName)));
throw new \TypeError(\sprintf('The table name must be an instance of "%s" or a string ("%s" given).', AbstractAsset::class, get_debug_type($tableName)));
}

return $tableName === $this->configuration['table_name'];
@@ -366,7 +366,7 @@ public function getExtraSetupSqlForTable(Table $createdTable): array
private function createAvailableMessagesQueryBuilder(): QueryBuilder
{
$now = new \DateTimeImmutable('UTC');
$redeliverLimit = $now->modify(sprintf('-%d seconds', $this->configuration['redeliver_timeout']));
$redeliverLimit = $now->modify(\sprintf('-%d seconds', $this->configuration['redeliver_timeout']));

return $this->createQueryBuilder()
->where('m.queue_name = ?')
6 changes: 3 additions & 3 deletions Transport/DoctrineReceiver.php
Original file line number Diff line number Diff line change
@@ -67,14 +67,14 @@ public function get(): iterable

public function ack(Envelope $envelope): void
{
$this->withRetryableExceptionRetry(function() use ($envelope) {
$this->withRetryableExceptionRetry(function () use ($envelope) {
$this->connection->ack($this->findDoctrineReceivedStamp($envelope)->getId());
});
}

public function reject(Envelope $envelope): void
{
$this->withRetryableExceptionRetry(function() use ($envelope) {
$this->withRetryableExceptionRetry(function () use ($envelope) {
$this->connection->reject($this->findDoctrineReceivedStamp($envelope)->getId());
});
}
@@ -159,7 +159,7 @@ private function withRetryableExceptionRetry(callable $callable): void
$callable();
} catch (RetryableException $exception) {
if (++$retries <= self::MAX_RETRIES) {
$delay *= $multiplier;
$delay *= $multiplier;

$randomness = (int) ($delay * $jitter);
$delay += random_int(-$randomness, +$randomness);
14 changes: 7 additions & 7 deletions Transport/PostgreSqlConnection.php
Original file line number Diff line number Diff line change
@@ -62,7 +62,7 @@ public function get(): ?array

// This is secure because the table name must be a valid identifier:
// https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
$this->executeStatement(sprintf('LISTEN "%s"', $this->configuration['table_name']));
$this->executeStatement(\sprintf('LISTEN "%s"', $this->configuration['table_name']));

/** @var \PDO $nativeConnection */
$nativeConnection = $this->driverConnection->getNativeConnection();
@@ -111,7 +111,7 @@ private function getTriggerSql(): array

return [
// create trigger function
sprintf(<<<'SQL'
\sprintf(<<<'SQL'
CREATE OR REPLACE FUNCTION %1$s() RETURNS TRIGGER AS $$
BEGIN
PERFORM pg_notify('%2$s', NEW.queue_name::text);
@@ -121,8 +121,8 @@ private function getTriggerSql(): array
SQL
, $functionName, $this->configuration['table_name']),
// register trigger
sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
sprintf('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON %1$s FOR EACH ROW EXECUTE PROCEDURE %2$s();', $this->configuration['table_name'], $functionName),
\sprintf('DROP TRIGGER IF EXISTS notify_trigger ON %s;', $this->configuration['table_name']),
\sprintf('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON %1$s FOR EACH ROW EXECUTE PROCEDURE %2$s();', $this->configuration['table_name'], $functionName),
];
}

@@ -131,14 +131,14 @@ private function createTriggerFunctionName(): string
$tableConfig = explode('.', $this->configuration['table_name']);

if (1 === \count($tableConfig)) {
return sprintf('notify_%1$s', $tableConfig[0]);
return \sprintf('notify_%1$s', $tableConfig[0]);
}

return sprintf('%1$s.notify_%2$s', $tableConfig[0], $tableConfig[1]);
return \sprintf('%1$s.notify_%2$s', $tableConfig[0], $tableConfig[1]);
}

private function unlisten(): void
{
$this->executeStatement(sprintf('UNLISTEN "%s"', $this->configuration['table_name']));
$this->executeStatement(\sprintf('UNLISTEN "%s"', $this->configuration['table_name']));
}
}