Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --gdpr-expressions-file option #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/Command/DumpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ protected function configure()
'Dump only rows selected by given WHERE condition.')
->addOption('gdpr-expressions', null, InputOption::VALUE_OPTIONAL,
'A json of gdpr sql-expressions keyed by table and column.')
->addOption('gdpr-expressions-file', null, InputOption::VALUE_OPTIONAL,
'File that contains a json of gdpr sql-expressions keyed by table and column.')
->addOption('gdpr-replacements', null, InputOption::VALUE_OPTIONAL,
'A json of gdpr replacement values keyed by table and column.')
->addOption('gdpr-replacements-file', null, InputOption::VALUE_OPTIONAL,
Expand Down Expand Up @@ -202,6 +204,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

if (!empty($dumpSettings['gdpr-expressions-file'])) {
$dumpSettings['gdpr-expressions'] = json_decode(file_get_contents($dumpSettings['gdpr-expressions-file']),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider splitting the lines like this

            $dumpSettings['gdpr-expressions'] = json_decode(
                file_get_contents($dumpSettings['gdpr-expressions-file']),
                true
            )

It will make it easier to read

true);
if (json_last_error()) {
throw new \UnexpectedValueException(sprintf('Invalid gdpr-expressions json (%s): %s',
json_last_error_msg(), $dumpSettings['gdpr-expressions']));
}
}

if (!empty($dumpSettings['gdpr-replacements'])) {
$dumpSettings['gdpr-replacements'] = json_decode($dumpSettings['gdpr-replacements'],
true);
Expand Down