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
added faker fixture command #1527
Conversation
Example: # users.php template
return [
'name' => 'name',
'phone' => 'phoneNumber',
'city' => 'city',
]; English version: #users.php generated fixture
return [
[
'name' => "Litzy Effertz Sr.",
'phone' => "300-413-7407",
'city' => "East Eraport",
],
[
'name' => "Marcelina Shanahan",
'phone' => "(699)210-2743",
'city' => "Boscostad",
],
[
'name' => "Mrs. Nico Reynolds IV",
'phone' => "1-716-733-0810x033",
'city' => "South Clemmieberg",
],
[
'name' => "Mary Wolf",
'phone' => "464-410-2653",
'city' => "West Heath",
],
[
'name' => "Kyla Gottlieb",
'phone' => "(479)691-1691x63812",
'city' => "Port Dashawn",
],
]; Russian version: return [
[
'name' => "Ситников Витольд Владимирович",
'phone' => "(35222) 97-2086",
'city' => "Дмитров",
],
[
'name' => "Ковалёв Захар Владимирович",
'phone' => "+7 (922) 574-6047",
'city' => "Клин",
],
[
'name' => "Романов Анатолий Алексеевич",
'phone' => "(495) 980-8701",
'city' => "Видное",
],
[
'name' => "Мишин Валериан Владимирович",
'phone' => "(495) 637-3634",
'city' => "Дорохово",
],
[
'name' => "Носов Прохор Максимович",
'phone' => "+7 (922) 117-4446",
'city' => "Дорохово",
],
]; there are a lot of languages and formatters (data providers) see this guide https://github.com/fzaninotto/Faker and source https://github.com/fzaninotto/Faker/tree/master/src/Faker/Provider |
Yes and also composer.json + license + changelog. you can copy them from other extensions. |
@cebe done, thanks. |
added base fixture controller. i think its ready for review and maybe merge :) |
also added default actions so this commands will be more useful. |
i cloned new my Yii2 repo so this branch is not available for me anymore. If there will be some bugs/suggestions they can be fixed/added after this one merge. Anyway this one is ready for review. |
assuming your repo remote is
and you'll have it back. |
thanks will do, i thought branch was automatically deleted :( |
* | ||
* class Book extends \Faker\Provider\Base | ||
* { | ||
* public function title($nbWords = 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does nb
mean in $nbWords
? Can it be renamed to be meaningful?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its just an example taken from Faker official guide. This is not part of current PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is in PR diff. That means it is part of it, isn't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, but it is in docs as you can see. Just an example for users so they dont need to go to Faker guide and search it there. As you can see it is very big https://github.com/fzaninotto/Faker and this example is just in the half of it.
Looks OK to me overall. Haven't actually tried using it though. |
ok, will fix all your suggestions. |
i think i will close this PR, because of i cant get this branch back (it was in my Yii2 github repo, but then i deleted it and forked new one from main Yii2 repo). So i guess i need to manually restore all files. |
you can do
to get your branch back. assuming origin is the name of your forks git remote |
@cebe i cant. i re-forked repo on github: deleted and then forked once again. my current remote dont have such branch. |
oh okay. |
Done, this is for issue #1506
Things to discuss:
actionUp
/actionDown
to apply fixtures to the table or reset table, very simple to implement. Also this will helpfaker\FixtureController
to be more useful for users because offaker\FixtureController < console\FixtureController
@samdark @qiangxue maybe some other thoughts/suggestions? other developers? :)