Skip to content

Conversation

@mpociot
Copy link

@mpociot mpociot commented Oct 30, 2020

This PR adds the ability to call more complex faker methods.

It follows an easy convention: FAKER_methodName:arguments
The arguments of the faker method can be separated by a comma.

Examples:

<?xml version="1.0" ?>
<slimdump>
    <table name="users" dump="full">
        <column name="username" dump="replace" replacement="FAKER_word" />
        <column name="password" dump="replace" replacement="test" />
        <column name="amount" dump="replace" replacement="FAKER_numberBetween:1,100" />
        <column name="lastname" dump="replace" replacement="FAKER_numerify:'Helo ###'" />
        <column name="email" dump="replace" replacement="FAKER_unique->randomDigitNot:0" />
    </table>
</slimdump>

Edit: I haven't changed the README yet, as I wasn't sure if you want this PR. If this gets merged, I can prepare a PR that modifies the documentation.

@janopae
Copy link
Member

janopae commented Nov 10, 2020

This is indeed a nice addition to the featureset of slimdump!

Are there any reasons to not use parantheses here (like FAKER_unique->randomDigitNot(0))? I think the closer we stay to the PHP syntax the better, as this removed the mental load of translating the Faker documentation into our own syntax.

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

Successfully merging this pull request may close these issues.

3 participants