-
-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use table comments for documentor's variable description #131
Conversation
Looks good to me |
Btw, I don't use gii for enything but the models, so there's not any changes to other templates. |
what happens if my column comment has line breaks? |
@Faryshta good point, line breaks should be replaced by |
@@ -24,7 +24,7 @@ | |||
* This is the model class for table "<?= $generator->generateTableName($tableName) ?>". | |||
* | |||
<?php foreach ($tableSchema->columns as $column): ?> | |||
* @property <?= "{$column->phpType} \${$column->name}\n" ?> | |||
* @property <?= "{$column->phpType} \${$column->name}" . ($generator->generateDocsFromComments ? " {$column->comment}" : '') . "\n" ?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strtr($column->comment, ["\n" => "\n * "])
Is this feature considered to be included? Since this PR isn't up to date anymore, I'm willing to create a new one given that it can be merged. Also, what about comments on the table itself? This information isn't currently available in the models, but it also could be read out (with a |
yes, go ahead :) |
Hello!
I am using PHPdoc comments a lot in my work and in Yii projects I have to copy-paste the db fileds' descriptions into my models, most of which is generated by gii. So, I've made some changes in gii's model generator to use the db comments in model's doc-block.
It's not such a big thing, but may be usefull for those who is using PHPdoc in their IDE.
The changes include generator propery, corresponding checkbox and default model template.