Skip to content

Navigation Menu

Sign in
Appearance settings
Sign up
Appearance settings
Discussion options

On Symfony 8.1 I created a command accepting an ULID as option.
Such option only accepts ULIDs expressed as Base32 (ex: 01KZV4NC6TSAXC9HWZWKD07NR9) but not if provided as RFC-4122

Example command

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Uid\Ulid;

#[AsCommand(name: 'foo')]
final readonly class FooCommand
{
    public function __invoke(#[Option] ?Ulid $ulid = null): int {
        dump($ulid);

        return Command::SUCCESS;
    }
}

This works:

  • bin/console foo --ulid=01KZV4NC6TSAXC9HWZWKD07NR9

This does not:

  • bin/console foo --ulid=019ff64a-b0da-caba-c4c7-9fe4da03d709

UidValueResolver calls Ulid::isValid() which defaults to Ulid::FORMAT_BASE_32.

Is there any plan to accept ULIDs in RFC-4122 format?

You must be logged in to vote

Replies: 1 comment · 1 reply

Comment options

Indeed that feels weird to me too; I opened #65321.

You must be logged in to vote
1 reply
@MatTheCat
Comment options

Well that was quick; should be fixed in 8.1.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.