Created
May 2, 2016 08:02
-
-
Save chuprik/38313e13fb2ab7be634fdbd1ea437eaa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace app\commands; | |
use yii\console\Controller; | |
use yii\db\ColumnSchema; | |
class PhpDocController extends Controller | |
{ | |
public function actionIndex() | |
{ | |
$schema = \Yii::$app->db->getSchema(); | |
$tables = $schema->getTableSchemas(); | |
foreach ($tables as $tableSchema) { | |
echo "/**\n"; | |
echo " * Table {$tableSchema->name}\n *\n"; | |
foreach ($tableSchema->columns as $name => $data) { | |
/** @var ColumnSchema $data */ | |
echo " * @property {$data->phpType} \${$name}\n"; | |
} | |
echo " */\n\n"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment