Skip to content

Commit 689ff99

Browse files
committed
Only requiring non-empty CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS in commands where relevant generators are actually used
1 parent ccca5d4 commit 689ff99

4 files changed

+16
-3
lines changed

commands/DnaYii2DbFrontendBatchController.php

+6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ class DnaYii2DbFrontendBatchController extends DnaBatchController
3333
public function actionIndex()
3434
{
3535

36+
// Require a config directive about what bootstrap include we should include (this script is used to activate providers for code generation)
37+
$alias = getenv('CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS');
38+
if (empty($alias)) {
39+
throw new Exception("CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS not set");
40+
}
41+
3642
$crudModels = \DataModel::crudModels();
3743
$qaStateModels = \DataModel::qaStateModels();
3844

commands/DnaYiiWorkflowUiBatchController.php

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class DnaYiiWorkflowUiBatchController extends DnaBatchController
1919

2020
public function actionIndex()
2121
{
22+
23+
// Require a config directive about what bootstrap include we should include (this script is used to activate providers for code generation)
24+
$alias = getenv('CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS');
25+
if (empty($alias)) {
26+
throw new Exception("CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS not set");
27+
}
28+
2229
$cruds = \DataModel::workflowUiItemModels();
2330

2431
foreach ($cruds AS $modelClass => $table) {

config/bootstrap.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
Yii::setAlias('@project', DNA_PROJECT_PATH);
44

55
$alias = getenv('CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS');
6-
require(Yii::getAlias($alias));
6+
if (!empty($alias)) {
7+
require(Yii::getAlias($alias));
8+
}

config/env.php

-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,4 @@
2424
Dotenv::required(['APP_NAME','APP_SUPPORT_EMAIL','APP_ADMIN_EMAIL']);
2525
Dotenv::required(['DATABASE_DSN','DATABASE_USER','DATABASE_PASSWORD']);
2626

27-
// Require a config directive about what bootstrap include we should include (this script is used to activate providers for code generation)
28-
Dotenv::required('CODE_GENERATOR_BOOTSTRAP_INCLUDE_ALIAS');
2927
Dotenv::setEnvironmentVariable('APP_VERSION', file_get_contents(__DIR__.'/../version'));

0 commit comments

Comments
 (0)