In many occasions, we need to share context for a single anonyzation run between anonymizers:
All this data must go directly to anonymizers, but using the Options instance is wrong:
- Even if we propagate some data into it, it is not shared (so goodbye sample table sharing).
- Adding more and more options into it makes anonymizers unable to use those options names for themselves.
The less impactful solution I found is the following:
- Create a new
Context class, which will carry all this information.
- Change constructor of
AbstractAnonymizer in order to accept this new parameter.
The PR #235 is a working proof of concept that introduce a new Context class in a backward compatibility fashion. If this PR is accepted, in 3.0, we will need to do the following change:
- Change
AbstractAnonymizer::__construct() signature, in order to accept both Options $options and Context $context parameters.
- Remove all backward compatibility layer accordinly.
- Follow many
@todo, #[\Deprecated] and associated \trigger_deprecation() calls we left in there to indicate us the right path for removal.
In many occasions, we need to share context for a single anonyzation run between anonymizers:
All this data must go directly to anonymizers, but using the
Optionsinstance is wrong:The less impactful solution I found is the following:
Contextclass, which will carry all this information.AbstractAnonymizerin order to accept this new parameter.The PR #235 is a working proof of concept that introduce a new
Contextclass in a backward compatibility fashion. If this PR is accepted, in 3.0, we will need to do the following change:AbstractAnonymizer::__construct()signature, in order to accept bothOptions $optionsandContext $contextparameters.@todo,#[\Deprecated]and associated\trigger_deprecation()calls we left in there to indicate us the right path for removal.