You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Anonymize by building text values using other anonymizers to fill holes in text.
4
+
5
+
@@@ standalone docker
6
+
7
+
```yaml [YAML]
8
+
# db_tools.config.yaml
9
+
anonymization:
10
+
default:
11
+
customer:
12
+
biography:
13
+
anonymizer: pattern
14
+
options: {value: '{firstname} {lastname} lives in {address:locality} in {address:country}, he has [2,7] cats.'}
15
+
#...
16
+
```
17
+
18
+
@@@
19
+
@@@ symfony
20
+
21
+
::: code-group
22
+
```php [Attribute]
23
+
namespace App\Entity;
24
+
25
+
use Doctrine\ORM\Mapping as ORM;
26
+
use MakinaCorpus\DbToolsBundle\Attribute\Anonymize;
27
+
28
+
#[ORM\Entity()]
29
+
#[ORM\Table(name: 'customer')]
30
+
class Customer
31
+
{
32
+
// ...
33
+
34
+
#[ORM\Column]
35
+
#[Anonymize(type: 'pattern', options: ['value' => '{firstname} {lastname} lives in {address:locality} in {address:country}, he has [2,7] cats.'])] // [!code ++]
36
+
private ?string $biography = null;
37
+
}
38
+
```
39
+
40
+
```yml [YAML]
41
+
# config/anonymization.yaml
42
+
43
+
customer:
44
+
biography:
45
+
anonymizer: pattern
46
+
options: {value: '{firstname} {lastname} lives in {address:locality} in {address:country}, he has [2,7] cats.'}
47
+
#...
48
+
```
49
+
:::
50
+
51
+
@@@
52
+
53
+
### Integer range
54
+
55
+
By adding `[MIN,MAX]` anywhere in your text, it will be replaced by a random integer
56
+
in the given range. For example `"I want [7,111] apples"`.
57
+
58
+
You can use negative integers such as `[-10,10]` or even a fully negative integer
59
+
range `[-127,-34]`.
60
+
61
+
### Single value from another anonymizer
62
+
63
+
By adding `{ANONYMIZER}` anywhere in your text, it will be replaced by a random value
64
+
given by the anonymizer. For example `"My email address is {email}, what's yours?"`.
65
+
66
+
:::warning
67
+
The target anonymizer must not be an multi-column anonymizer.
68
+
:::
69
+
70
+
### Column value from a multi-column anonymizer
71
+
72
+
By adding `{ANONYMIZER:COLUMN}` anywhere in your text, it will be replaced by a random
73
+
value for the named column given by the anonymizer. For example, `"The country I live into is {address:country}."`.
74
+
75
+
If you use more than one column of the same anonymizer in the same text value, the same
76
+
generated row from the target anonymizer will be used. For example, this text will give
77
+
a consistent result: `"The country I live in {address:locality} in {address:country}."`.
78
+
79
+
:::warning
80
+
The target anonymizer must be a multi-column anonymizer.
0 commit comments