Skip to content

Commit f546b4c

Browse files
committed
ModelClassDescription
1 parent 444bfae commit f546b4c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/generator/default/dbmodel.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,14 @@
1111
<?= '<?php' ?>
1212

1313

14+
/**
15+
* This file is generated by Gii, do not change manually!
16+
*/
17+
1418
namespace <?= $namespace ?>;
1519

1620
/**
17-
*<?= empty($model->description) ? '' : str_replace("\n", "\n * ", ' ' . trim($model->description)) ?>
21+
*<?= $model->getModelClassDescription() ?>
1822

1923
*
2024
<?php foreach ($model->dbAttributes() as $attribute): ?>
@@ -48,7 +52,7 @@ abstract class <?= $model->getClassName() ?> extends \yii\db\ActiveRecord
4852
<?php if($scenarios = $model->getScenarios()):
4953
foreach($scenarios as $scenario): ?>
5054
/**
51-
* <?=$scenario['description']?>
55+
* <?= $scenario['description'] ?>
5256

5357
*/
5458
public const <?= $scenario['const'] ?> = '<?= $scenario['name'] ?>';

src/lib/items/DbModel.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,4 +234,10 @@ private function getScenariosByOpenapiSchema(): array
234234
return $scenarios;
235235
}
236236

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+
}
237243
}

0 commit comments

Comments
 (0)