Reputation: 172
I was looking at symfony validation and I would like to know how these error hashes are generated?
Example from NotBlank constrain:
const IS_BLANK_ERROR = 'c1051bb4-d103-4f74-8988-acbcafc7fdc3';
For example if I need make my custom constrain I guess a random unique code should be defined for any reason. How does symfony generate it?
Upvotes: 0
Views: 169
Reputation: 4304
This is a constant, which means it was simply put there by whoever wrote the code.
I does look like an UUID. So, if you want to duplicate this method, you could just generate an UUID for yourself. There are libraries that do it. If you simply need one UUID, you could use online UUID generator like this one.
One popular library is ramsey/uuid
- here is link to source.
Upvotes: 1