2
votes

I was wondering what is the usage of these codes that are in each validator, i.e. in https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Validator/Constraints/NotBlank.php#L24

class NotBlank extends Constraint
{
    const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3';

I could not find any documentation about it, neither in http://symfony.com/doc/master/validation/custom_constraint.html: what algorithm is used to generate them?

1

1 Answers

2
votes

It seems to be a UUID. From Wikipedia:

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. The term globally unique identifier (GUID) is also used.

When generated according to the standard methods, UUIDs are for practical purposes unique, without depending for their uniqueness on a central registration authority or coordination between the parties generating them, unlike most other numbering schemes. While the probability that a UUID will be duplicated is not zero, it is close enough to zero to be negligible.

In PHP you can generate it using UUID PECL package or using a library like this one.