mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-01 11:39:41 +08:00
fixed docs
This commit is contained in:
@ -69,14 +69,11 @@ In this script, you can use the following two predefined variables:
|
||||
With such a template file, you can generate your fixtures using the commands like the following:
|
||||
|
||||
```
|
||||
# generate fixtures for the users table based on users fixture template
|
||||
php yii fixture/generate User
|
||||
|
||||
# also a short version of this command ("generate" action is default)
|
||||
php yii fixture User
|
||||
# generate fixtures from user fixture template
|
||||
php yii fixture/generate user
|
||||
|
||||
# to generate several fixture data files
|
||||
php yii fixture User Profile Team
|
||||
php yii fixture user profile team
|
||||
```
|
||||
|
||||
In the code above `users` is template name. After running this command, a new file with the same template name
|
||||
@ -113,17 +110,13 @@ After you created custom provider, for example:
|
||||
```php
|
||||
class Book extends \Faker\Provider\Base
|
||||
{
|
||||
|
||||
public function title($nbWords = 5)
|
||||
{
|
||||
$sentence = $this->generator->sentence($nbWords);
|
||||
return mb_substr($sentence, 0, mb_strlen($sentence) - 1);
|
||||
}
|
||||
|
||||
public function ISBN()
|
||||
{
|
||||
return $this->generator->randomNumber(13);
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user