Closed pounard closed 8 months ago
This validation could also be used by the db-tools:anonymization:dump-config
command.
Exactly what I was thinking about ! We probably should not block in case of invalid options for production operation.
Also, I'd like to add helpers on the Option
class, such as:
getInt(string $name, int $default, bool $required = false): ?int;
getFloat(string $name, float $default, bool $required = false): ?float;
getDate(string $name, \DateTimeImmutable $default, bool $required = false): ?\DateTimeImmutable;
getInterval(string $name, \DateInterval $default, bool $required = false): ?\DateInterval;
And add new helper along the way for anonymizers to use.
@SimonMellerin @Lonnytunes what is your opinion about this?
I'm not sure about this, I prefer to keep things simple for now and not over-anticipate needs
It would validates the user input, and I already copy/pasted code (for example the parseDate()).
This has been implemented, see #128 ans #131
It is already on the main
branch and will be available in the next release (1.1.x
expected for the next week)
As stated in https://github.com/makinacorpus/DbToolsBundle/pull/96#discussion_r1497552466 there might some room for improvements in options handling:
AbstractAnonymizer
, we don't have any global options right now, but we might have later,AbstractAnonymizer::validateOptions(Options $options)
for each anonymizer to provide validation for its own options,question remains, should the seed/salt be injected in options ?done in https://github.com/makinacorpus/DbToolsBundle/pull/96