File tree Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Expand file tree Collapse file tree 3 files changed +22
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
namespace cebe \yii2openapi \generator ;
9
9
10
+ use cebe \yii2openapi \lib \items \DbModel ;
10
11
use yii \db \mysql \Schema as MySqlSchema ;
11
12
use SamIT \Yii2 \MariaDb \Schema as MariaDbSchema ;
12
13
use yii \db \pgsql \Schema as PgSqlSchema ;
@@ -133,6 +134,15 @@ class ApiGenerator extends Generator
133
134
*/
134
135
public $ excludeModels = [];
135
136
137
+ /**
138
+ * @var array Map for custom dbModels
139
+ * @example
140
+ * 'dbModel' => [
141
+ * 'scenarioDefaultDescription' => " Scenario {name}", @see DbModel::$scenarioDefaultDescription
142
+ * ]
143
+ */
144
+ public $ dbModel = [];
145
+
136
146
/**
137
147
* @var array Map for custom controller names not based on model name for exclusive cases
138
148
* @example
Original file line number Diff line number Diff line change @@ -109,6 +109,15 @@ class Config extends BaseObject
109
109
*/
110
110
public $ excludeModels = [];
111
111
112
+ /**
113
+ * @var array Map for custom dbModels
114
+ * @example
115
+ * 'dbModel' => [
116
+ * 'scenarioDefaultDescription' => " Scenario {name}", @see DbModel::$scenarioDefaultDescription
117
+ * ]
118
+ */
119
+ public $ dbModel = [];
120
+
112
121
/**
113
122
* @var array Map for custom controller names not based on model name for exclusive cases
114
123
* @example
Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ public function generate():CodeFiles
56
56
}
57
57
foreach ($ this ->models as $ model ) {
58
58
$ className = $ model ->getClassName ();
59
+ if (!empty ($ this ->config ->dbModel ['scenarioDefaultDescription ' ])) {
60
+ $ model ->scenarioDefaultDescription = $ this ->config ->dbModel ['scenarioDefaultDescription ' ];
61
+ }
59
62
if ($ model ->isNotDb === false ) {
60
63
$ this ->files ->add (new CodeFile (
61
64
Yii::getAlias ("$ modelPath/base/ $ className.php " ),
You can’t perform that action at this time.
0 commit comments