- Anonymize customer with the GDPR section in the admin customer show.
- Export customer data with the GDPR section in the admin customer show.
Click to see the anonymization configuration.
Click to see the export data configuration.
- Anonymize any entity with command for example :
php bin/console synolia:gdpr:anonymize --entity='Sylius\Component\Core\Model\Customer' --id=1 Use --help to get more informations
| Version | |
|---|---|
| PHP | ^8.2 |
| Sylius | ^2.0 |
-
Add the bundle and dependencies in your composer.json :
composer require synolia/sylius-gdpr-plugin --no-scripts
-
Create required config in
config/packages/gdpr.yamlfile:imports: - { resource: "@SynoliaSyliusGDPRPlugin/Resources/config/app/config.yaml" }
-
Create routing in
config/routes/gdpr.yamlfile:synolia_gdpr: resource: "@SynoliaSyliusGDPRPlugin/Resources/config/routes.yaml" prefix: '/%sylius_admin.path_name%'
-
Process translations
php bin/console translation:extract en SynoliaSyliusGDPRPlugin --dump-messages php bin/console translation:extract fr SynoliaSyliusGDPRPlugin --dump-messages
-
Clear cache
php bin/console cache:clear
synolia_sylius_gdpr:
disable_default_mappings: false # False by default
anonymization:
mappings:
paths:
- # Your\Paths\To\Mappings\DirectoryExample of configuration
Sylius\Component\Core\Model\Address: # Your class path
properties:
firstName:
faker: text # let's see => https://fakerphp.github.io/formatters/
args: [20] # The associated faker arguments
prefix: 'anonymized-'
lastName:
value: 'Fake lastName'
prefix: 'anonymized-'value can be null, an array, an int, a string and an expression language
Example of configuration with dynamic value
Sylius\Component\Core\Model\Customer:
properties:
firstName:
value: '@="some-arbitrary-text..." ~ object.getId() ~ "...more-arbitrary-text"'your expression language must starts with
@=to be evaluated properly
variable
objectis the current entity you are dealing with (e.g. in that caseSylius\Component\Core\Model\Customer)
There's two steps to add your custom form into the page:
- Override the controller service by setting the link of your FormType in the $formsType variable
Synolia\SyliusGDPRPlugin\Controller\AdvancedActionsController:
arguments:
$formsType:
- 'Synolia\SyliusGDPRPlugin\Form\Type\Actions\AnonymizeCustomerNotLoggedSinceType'
tags: ['controller.service_arguments']or use php attributes
#[AsController]on your controller and#[Autowire(AnonymizeCustomerNotLoggedSinceType::class)]in your constructor for$formsTypeparameter
- Then create your form processor by implementing Synolia\SyliusGDPRPlugin\Processor\AnonymizerProcessor\AdvancedActionsFormDataProcessorInterface
There a form processor example
- Synolia\SyliusGDPRPlugin\Event\BeforeAnonymize
- Synolia\SyliusGDPRPlugin\Event\AfterAnonymize
- Synolia\SyliusGDPRPlugin\Event\BeforeCustomerAnonymize
- Synolia\SyliusGDPRPlugin\Event\AfterCustomerAnonymize
- Synolia\SyliusGDPRPlugin\Event\BeforeExportCustomerData
See How to contribute.
This library is under the EUPL-1.2 license.
Developed by Synolia.
