alexandre-daubois
Repos
9
Followers
36
Following
12

The Symfony PHP framework

28142
8785

The Symfony documentation

2024
4825

Provides an object-oriented API to query in-memory collections in a SQL-style.

16
1

Events

issue comment
[SensioFrameworkExtraBundle] Add message in the bundle documentation page

Do we really need to? I mean, the whole documentation of the latest versions of Symfony stopped mention Sensio's bundle. If one follows the documentation, all attributes used are core ones 😄 But I may be missing the point and maybe the doc could be improved somewhere?

Created at 3 hours ago
alexandre-daubois delete branch remove-exception-backticks
Created at 4 hours ago
issue comment
[Console][DoctrineBridge] Remove backticks from exception messages

Oh you're right, that's rebased :slightly_smiling_face:

Created at 8 hours ago

[VarDumper] Add caster for WeakMap

[Notifier][Line] Fix tests

minor #48477 [Notifier] [Line] Fix tests (OskarStark)

This PR was merged into the 6.3 branch.

Discussion

[Notifier] [Line] Fix tests

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a

Follows

  • #48466

cc @kurozumi

Commits

9a878526d2 [Notifier][Line] Fix tests

[DependencyInjection][HttpKernel] Introduce build parameters

feature #47680 [DependencyInjection][HttpKernel] Introduce build parameters (HeahDude)

This PR was squashed before being merged into the 6.3 branch.

Discussion

[DependencyInjection][HttpKernel] Introduce build parameters

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | yes | Tickets | ~ | License | MIT | Doc PR | TODO

Alternative implementation of #47608. Add a convention for parameters named with a starting dot to be available at compile-time only:

$containerBuilder->setParameter('foo'); // nothing changes
$containerBuilder->setParameter('.bar'); // will not be dumped

Calling $container->getParameter('.bar') on a compiled container will throw.

Commits

c75dbca8f0 [DependencyInjection][HttpKernel] Introduce build parameters

feature #48478 [VarDumper] Add caster for WeakMap (nicolas-grekas)

This PR was merged into the 6.3 branch.

Discussion

[VarDumper] Add caster for WeakMap

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | -

Commits

bde17b7f51 [VarDumper] Add caster for WeakMap

feature #48362 [Clock] Add ClockAwareTrait to help write time-sensitive classes (nicolas-grekas)

This PR was merged into the 6.3 branch.

Discussion

[Clock] Add ClockAwareTrait to help write time-sensitive classes

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | - | License | MIT | Doc PR | -

Add the trait and use $this->now() inside the class, autowiring will do the magic :muscle:

Commits

8e2af95ac6 [Clock] Add ClockAwareTrait to help write time-sensitive classes

feature #48101 [Notifier] Add Mastodon Notifier (qdequippe)

This PR was merged into the 6.3 branch.

Discussion

[Notifier] Add Mastodon Notifier

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | https://github.com/symfony/symfony-docs/pull/17411 | Recipe | https://github.com/symfony/recipes/pull/1141

Migrate from Twitter with this new Symfony Notifier Bridge for Mastodon :)

Commits

d097a63983 Add Mastodon Notifier

[DependencyInjection] Remove refs that point to container.excluded services when allowed

[Console] Do no preprend empty line if the buffer is empty

bug #48483 [DependencyInjection] Remove refs that point to container.excluded services when allowed (nicolas-grekas)

This PR was merged into the 6.2 branch.

Discussion

[DependencyInjection] Remove refs that point to container.excluded services when allowed

| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #48411 | License | MIT | Doc PR | -

Commits

2e9fdf0e60 [DependencyInjection] Remove refs that point to container.excluded services when allowed

[Notifier] Fix Termii bridge exception test

[DependencyInjection] Fix typo in RemoveBuildParametersPassTest

minor #48497 [Notifier] Fix Termii bridge exception test (gnito-org)

This PR was merged into the 6.3 branch.

Discussion

[Notifier] Fix Termii bridge exception test

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |

Commits

1e40f0faed [Notifier] Fix Termii bridge exception test

[Notifier] Fix RingCentral bridge exception test

minor #48493 [Notifier] Fix RingCentral bridge exception test (gnito-org)

This PR was merged into the 6.3 branch.

Discussion

[Notifier] Fix RingCentral bridge exception test

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |

Commits

b65b78b8c5 [Notifier] Fix RingCentral bridge exception test

minor #48490 [DependencyInjection] Fix typo in RemoveBuildParametersPassTest (alamirault)

This PR was merged into the 6.3 branch.

Discussion

[DependencyInjection] Fix typo in RemoveBuildParametersPassTest

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | Fix #... | License | MIT | Doc PR | symfony/symfony-docs#...

Commits

795afb1f45 [DependencyInjection] Fix typo in RemoveBuildParametersPassTest

[Notifier] Add options to SmsMessage

minor #48475 [WebProfilerBundle] Fix the dump view panel (94noni)

This PR was merged into the 6.2 branch.

Discussion

[WebProfilerBundle] Fix the dump view panel

| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | view fix | New feature? | no | Deprecations? | no | Tickets | Fix my OCD ^^, | License | MIT | Doc PR | .

Hi, checking the new profiler, I've came accros this and it bothered me So this PR fix the view of the dump panel to be similar to others

Commits

f00db9faee [Profiler] Fix the dump view panel

minor #48487 [Console] Do no preprend empty line if the buffer is empty (lyrixx)

This PR was merged into the 6.3 branch.

Discussion

[Console] Do no preprend empty line if the buffer is empty

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |

It's really weird to preprend an empty line when in our code we write:

protected function execute(InputInterface $input, OutputInterface $output): int
{
    $io = new SymfonyStyle($input, $output);
    $io->text(sprintf('Running project %s', $project->getId()));
}

Commits

a9f1250c1e [Console] Do no preprend empty line if the buffer is empty

Created at 8 hours ago
alexandre-daubois create branch remove-exception-backticks-6.3
Created at 8 hours ago
pull request opened
[DoctrineBridge][Console] Remove backticks from exception messages

| Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | NA | License | MIT | Doc PR | NA

Follow-up of https://github.com/symfony/symfony/pull/49822#discussion_r1149282713, removes backticks of a few exception messages.

Created at 8 hours ago
alexandre-daubois create branch remove-exception-backticks
Created at 8 hours ago

[Console] Make sure signals registered by SignalableCommandInterface commands are defined in the PCNTL extension

Created at 8 hours ago

[Console] Make sure signals registered by SignalableCommandInterface commands are defined in the PCNTL extension

Created at 8 hours ago

[Console] Make sure signals registered by SignalableCommandInterface commands are defined in the PCNTL extension

Created at 8 hours ago
issue comment
[Console] Make sure signals registered by `SignalableCommandInterface` commands are defined in the PCNTL extension

I updated the SignalRegistry to check if the signal code is less than 32. Indeed, pcntl_signal_get_handler() in SignalRegistry if the signal code is above 31.

I also added a few tests for SignalRegistry.

Created at 8 hours ago

[Console] Make sure signals registered by SignalableCommandInterface commands are defined in the PCNTL extension

Created at 8 hours ago
issue comment
[Console] Make sure signals registered by `SignalableCommandInterface` commands are defined in the PCNTL extension

@lyrixx I tried this snippet:

<?php

function sig_handler($signo)
{
     switch ($signo) {
         default:
     }
}

echo "Installing signal handler";

// setup signal handlers
pcntl_signal(66,  "sig_handler");

And here is the result:

Installing signal handlerPHP Fatal error:  Uncaught ValueError: pcntl_signal(): Argument #1 ($signal) must be less than 65 in /home/alex/signals.php:13
Stack trace:
#0 /home/alex/signals.php(13): pcntl_signal()
#1 {main}
  thrown in /home/alex/signals.php on line 15

So we should at least check that the signal number is lower than 65. Checking that the given signal is defined in the extension comes from this comment from Nicolas: https://github.com/symfony/symfony/pull/49750#discussion_r1144036134. What do you think?

Created at 14 hours ago

[Console] Make sure signals registered by SignalableCommandInterface commands are defined in the PCNTL extension

Created at 1 day ago
pull request opened
[Console] Make sure signals registered by `SignalableCommandInterface` commands are defined in the PCNTL extension

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | NA | License | MIT | Doc PR | No need I guess

Adding this new method in SignalRegistry can also be leveraged in https://github.com/symfony/symfony/pull/49750

Created at 1 day ago
alexandre-daubois create branch signalable-command-valid-signals
Created at 1 day ago

[String] Correct inflection of 'codes' and 'names'

Add the Scheduler component

[Scheduler] Rework the component

[Validator] Update BIC validator IBAN mappings

[DependencyInjection] Add support for generating lazy closures

[ErrorHandler] Fixed tests

minor #49707 [ErrorHandler] Fixed tests (lyrixx)

This PR was merged into the 6.3 branch.

Discussion

[ErrorHandler] Fixed tests

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |

Commits

bb8b73ea22 [ErrorHandler] Fixed tests

feature #47112 [Messenger] Add a scheduler component (upyx, fabpot)

This PR was merged into the 6.3 branch.

Discussion

[Messenger] Add a scheduler component

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | no | License | MIT | Doc PR | TBD

Introdution

There is no easy way to schedule periodical tasks. There are few useful tools which I touched:

  • https://github.com/Guikingone/SchedulerBundle
  • https://github.com/Cron/Symfony-Bundle
  • https://github.com/zenstruck/schedule-bundle
  • https://github.com/lavary/crunz

They are complicated. They doesn't allow to set time with precision in seconds (at least it isn't easy). They require difficult tricks to set not linear periods (like on sunset in Tokyo). ~They are~ Part of them inefficient with infrequent tasks because resources are needed on every run (e.g. Kubernetes CronJob creates and destroes an entire container).

Proposal

I use a custom transport of Messenger that generates messages periodically. It's a simple solution to run periodical jobs without external software. It's especially helpful in environments where additional runners are impossible or very painful (like Kubernetes). Configuration is very flexible and accurate, it's possible to configure any rules when to run or not to run.

Compared to crond: there is no need to install something external, precision of schedule in microseconds instead of minutes, it's possible to set any periods.

Simple example

# messenger.yaml
framework:
  messenger:
    transports:
      schedule_default: 'schedule://default'

Few types of messages:

class SomeJob {}
class OtherJob {}

A handlers:

#[AsMessageHandler]
class SomeJobHandler {
    public function __invoke(SomeJob $job) {
        // do job or delegate it to other service
    }
}

#[AsMessageHandler]
class OtherJobHandler {
    public function __invoke(OtherJob $job) {
        // do job or delegate it to other service
    }
}

A schedules are provided by locators. It's possible to create many locators and/or provide many schedules by the same locator:

class ExampleLocator implements ScheduleLocatorInterface
{
    public function get(string $id): ScheduleConfig
    {
        // once after an hour from now
        $deferForAnHour = new \DatePeriod(
            new \DateTimeImmutable('now'),
            new \DateInterval('PT1H'),
            1,
            \DatePeriod::EXCLUDE_START_DATE
        );

        return (new ScheduleConfig())
            ->add(new OnceTrigger(new \DateTimeImmutable()), new WarmUpJob()) // once on every worker's start
            ->add(PeriodicalTrigger::create('P1D', '2022-01-01T03:00:00Z'), new SomeJob()) // every night at 3 a.m. (UTC)
            ->add(PeriodicalTrigger::fromPeriod($deferForAnHour), new OtherJob())
        ;
    }

    public function has(string $id): bool
    {
        return 'default' === $id;
    }
}

To run schedule:

bin/console messenger:consume schedule_default

It's easy to run jobs manually:

#[AsCommand(name: 'some', description: 'Manually runs SomeJob')]
class SomeCommand extends Command {
    public function __construct(private MessageBusInterface $bus) {
    }

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $this->bus->dispatch(new SomeJob());
    }
}

Example with returning a result

class GoodJob {
    public function __construct(public readonly ?LoggerInterface $logger) {
    }
}
#[AsMessageHandler]
class GoodHandler {
    public function __construct(private readonly LoggerInterface $logger) {
    }

    public function __invoke(GoodJob $job){
        // compute $result
        ($job->logger ?? $this->logger)->info('The result is: {result}', ['result' => $result])
    }
}
#[AsCommand(name: 'job', description: 'Manually runs job')]
class SomeCommand extends Command {
    public function __construct(private MessageBusInterface $bus) {
    }

    protected function execute(InputInterface $input, OutputInterface $output): int {
        $this->bus->dispatch(new GoodJob(new ConsoleLogger($output))); // result will be printed in console
    }
}

Configuring

A minimal configuration:

# messenger.yaml
framework:
  messenger:
    transports:
      schedule_default: 'schedule://default'

More complex example:

# messenger.yaml
framework:
  messenger:
    transports:
      schedule_default:
        dsn: 'schedule://default'
        options:
          cache: 'app.cache'
          lock: 'default'

Example HA configuration with redis:

framework:
  cache:
    default_redis_provider: '%env(REDIS_DSN)%'
  lock:
    redis: '%env(REDIS_DSN)%'
  messenger:
    transports:
      schedule_default:
        dsn: 'schedule://default'
        options:
          cache: 'cache.redis'
          lock:
            resource: 'redis'
            ttl: 60
            auto_release: true

Deprecations

None

Implementation

This PR contains an implementation.

ToDo

  • [x] Remove obsolete code
  • [x] Add a configuration to the Framework
  • [x] Specialize exceptions and improve messages
  • [x] Cover with tests
  • [ ] Add acceptance tests for HA
  • [x] Fix CHANGELOGs & READMEs
  • [ ] Add documentation

Commits

a18127b789 [Scheduler] Rework the component 6d9311f087 Add the Scheduler component

add translations for the filename max length validator option

explicitly set the HTTP method override option to false

minor #49715 [FrameworkBundle] explicitly set the HTTP method override option to false (xabbuh)

This PR was merged into the 6.2 branch.

Discussion

[FrameworkBundle] explicitly set the HTTP method override option to false

| Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | | License | MIT | Doc PR |

Commits

489f9ca64d explicitly set the HTTP method override option to false

[Scheduler] Fix some minor bugs

Merge branch '6.2' into 6.3

  • 6.2: explicitly set the HTTP method override option to false

[HttpFoundation] Add ParameterBag::getString() and deprecate accepting invalid values

[Scheduler] Remove unused variable in AddScheduleMessengerPass

minor #49717 [Scheduler] Remove unused variable in AddScheduleMessengerPass (onEXHovia)

This PR was merged into the 6.3 branch.

Discussion

[Scheduler] Remove unused variable in AddScheduleMessengerPass

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a

Commits

09df772306 [Scheduler] Remove unused variable in AddScheduleMessengerPass

[Notifier] Add "retry" and "expire" options to Pushover bridge

minor #49695 [Notifier] Add "retry" and "expire" options to Pushover bridge (vlepeule)

This PR was squashed before being merged into the 6.3 branch.

Discussion

[Notifier] Add "retry" and "expire" options to Pushover bridge

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | -

Add "retry" and "expire" options to handle "Emergency Priority", according to Pushover API documentation :

To send an emergency-priority notification, the priority parameter must be set to 2 and the retry and expire parameters must be supplied.

Commits

2feabc641c [Notifier] Add "retry" and "expire" options to Pushover bridge

minor #49716 [Scheduler] Fix some minor bugs (fabpot)

This PR was merged into the 6.3 branch.

Discussion

[Scheduler] Fix some minor bugs

| Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | n/a

Commits

9fc7cf53dd [Scheduler] Fix some minor bugs

Stop stopwatch events in case of exception

Created at 2 days ago
issue comment
[Webhook][RemoteEvent] Add the components

The Webhook documentation is in progress: https://github.com/symfony/symfony-docs/pull/17964

Created at 4 days ago

[Webhook] Add new component documentation

Created at 4 days ago
alexandre-daubois delete branch fix-abstract-test-case
Created at 5 days ago