File tree Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Expand file tree Collapse file tree 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 11
11
<?= '<?php ' ?>
12
12
13
13
14
+ /**
15
+ * This file is generated by Gii, do not change manually!
16
+ */
17
+
14
18
namespace <?= $ namespace ?> ;
15
19
16
20
/**
17
- *<?= empty ( $ model ->description ) ? '' : str_replace ( "\n" , "\n * " , ' ' . trim ( $ model -> description ) ) ?>
21
+ *<?= $ model ->getModelClassDescription ( ) ?>
18
22
19
23
*
20
24
<?php foreach ($ model ->dbAttributes () as $ attribute ): ?>
@@ -48,7 +52,7 @@ abstract class <?= $model->getClassName() ?> extends \yii\db\ActiveRecord
48
52
<?php if ($ scenarios = $ model ->getScenarios ()):
49
53
foreach ($ scenarios as $ scenario ): ?>
50
54
/**
51
- * <?= $ scenario ['description ' ]?>
55
+ * <?= $ scenario ['description ' ] ?>
52
56
53
57
*/
54
58
public const <?= $ scenario ['const ' ] ?> = '<?= $ scenario ['name ' ] ?> ';
Original file line number Diff line number Diff line change @@ -234,4 +234,25 @@ private function getScenariosByOpenapiSchema(): array
234
234
return $ scenarios ;
235
235
}
236
236
237
+ public function getModelClassDescription_ ()
238
+ {
239
+ return !empty ($ this ->description ) ?
240
+ str_replace ("\n" , "\n * " , ' ' . trim ($ this ->description ))
241
+ : ' This is the model class for table " ' .$ this ->tableName .'". ' ;
242
+ }
243
+
244
+ /** @noinspection PhpParamsInspection */
245
+ public function getModelClassDescription ()
246
+ {
247
+ if (empty ($ this ->description )) {
248
+ return ' This is the model class for table " ' .$ this ->tableName .'". ' ;
249
+ }
250
+
251
+ $ descriptionArr = explode ("\n" , $ this ->description );
252
+ $ descriptionArr = array_map ('trim ' , $ descriptionArr );
253
+ $ descriptionArr = array_map (function ($ item ) {
254
+ return $ item !== '' ? ' ' . $ item : $ item ;
255
+ }, $ descriptionArr );
256
+ return implode ("\n * " , $ descriptionArr );
257
+ }
237
258
}
You can’t perform that action at this time.
0 commit comments