Skip to content

add fix on seed method #26

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

Open
wants to merge 1 commit into
base: v4.x
Choose a base branch
from

Conversation

mmagdiel
Copy link

@mmagdiel mmagdiel commented Jun 3, 2025

What kind of change does this PR introduce? (pls check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe below

Description

I was trying to run this migration but I couldn't.
type: '@faker.randomElements:bank,cash'

After drawing the application, he discovered that the error was in this line of code. The argument was sent to the function, but the case of that argument being a array was not considered, so it was passed as a string and subsequently failed to execute the Faker library.

$localFakerInstance = $localFakerInstance->{$fakerMethod[0]}($fakerMethod[1]);

The solution is to evaluate whether the condition is an array and format it so that the function actually runs in the generator.

                                if (strpos($fakerMethod[1], ',') !== false) {
                                    $arr = explode(",",$fakerMethod[1]);
                                    $localFakerInstance = $localFakerInstance->{$fakerMethod[0]}($arr);

If it is not an arrangement, the previous condition is executed and the regular flow of the application continues.

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Related Issue

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.

1 participant