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

Feature Request: Add Faker integration for replacements #19

Closed
franziskahahn opened this issue Dec 23, 2016 · 2 comments
Closed

Feature Request: Add Faker integration for replacements #19

franziskahahn opened this issue Dec 23, 2016 · 2 comments

Comments

@franziskahahn
Copy link
Contributor

The replacement with "x" is helpful but I think replacements with other characters - or even better: human readable values - is an often needed use case.

What do you think about implementing at least some basic options?

Just a (very quick and dirty) draft I created today:

        if ($this->dump == Config::REPLACE) {
            $replacement = $this->config->attributes()->replacement;

            $faker = Faker\Factory::create('de_DE');

            if ($replacement == 'FAKER_IBAN') {
                return $faker->iban('DE');
            } else if ($replacement == 'FAKER_NAME') {
                return $faker->firstName() . ' ' . $faker->lastName();
            }

            return $replacement;
        }

And the config could look like this:

<column name="username" dump="replace" replacement="FAKER_NAME" />
@mpdude
Copy link
Member

mpdude commented Jan 2, 2017

Thanks for your suggestion!

Indeed, I've been thinking about this because I saw that @josecanhelp has tried something similar at master...josecanhelp:slimdump.

I'd be 👍 for such a change as indeed the results may be much better when it comes to readability, developer experience and also data privacy.

Do you think you could come up with a PR that fits into the current configuration syntax and allows to choose from the various Faker providers or even hook up new/custom ones in a generic way?

As a side note: Personally, I haven't yet had the need for something like this. In fact, it turned out helpful a few times already that slimdump dump were "reproducible", that is, you could perform diffs between dumps and see only the changed lines. That might not be the case when Faker data comes into play, but that's just an option you don't have to use :)

@franziskahahn
Copy link
Contributor Author

Here you go: #21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants