/
Bootstrap.php
35 lines (32 loc) · 971 Bytes
/
Bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/**
* @link https://github.com/AnatolyRugalev
* @copyright Copyright (c) AnatolyRugalev
* @license https://tldrlegal.com/license/gnu-general-public-license-v3-(gpl-3)
*/
namespace understeam\fixture;
use Yii;
use yii\base\Application;
use yii\base\BootstrapInterface;
/**
* Bootstrap class to load generator automatically
* @author Anatoly Rugalev
* @link https://github.com/AnatolyRugalev
*/
class Bootstrap implements BootstrapInterface
{
/**
* Bootstrap method to be called during application bootstrap stage.
* @param Application $app the application currently running
*/
public function bootstrap($app)
{
if ($app->hasModule('gii')) {
if (!isset($app->getModule('gii')->generators['fixture-generator'])) {
$app->getModule('gii')->generators['fixture-generator'] = [
'class' => __NAMESPACE__ . '\\FixtureGenerator',
];
}
}
}
}