Step2: Create a static method in that controller named "getTableNameFromModel()" and add the following code in it.
<?php public static function getTableNameFromModel($model) { return $model::model()->tableSchema->name; } ?>
Step3: Call function from your model/view/controller by passing model name as a parameter.
<?php $model=new User; echo CommonController::getTableNameFromModel($model); ?>
It'll return table name of the corresponding model.
Hope it'll help you. Thanks.
Read Next: Get column names from model Yii
Bannerlord Benzeri Oyunlar
ReplyDeleteOutlast Benzeri Oyunlar
Limbo Benzeri Oyunlar
Travian Benzeri Oyunlar
Uncharted Benzeri Oyunlar
UXH4K