While working on Yii2 for update MYSQL Database table having Foreign key constraints faced the issue of DBTypeCast Function not exists.
Tried to drill down into core code of YII2 and found that function "DBTypeCast" is mention in class yii\db\ColumnSchema
but when there is FK on any column this class is not getting bind to table schema object instead of this its bind the " stdClass Object. and because of this its not allowing to execute the update.
Here are the some function which are getting called in this functionality fro Schema.php file
> loadTableSchema -> findColumns -> findConstraints
how we can assign yii\db\ColumnSchema to columns having FK.
[config_tid] => yii\db\ColumnSchema Object ( [name] => config_tid [allowNull] => [type] => integer [phpType] => integer [dbType] => int(11) [defaultValue] => [enumValues] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => 1 [autoIncrement] => 1 [unsigned] => [comment] => ) [test_code] => stdClass Object ( [name] => test_code [allowNull] => 1 [type] => string [phpType] => string [dbType] => varchar(30) [defaultValue] => [enumValues] => [size] => 30 [precision] => 30 [scale] => [isPrimaryKey] => [autoIncrement] => [unsigned] => [comment] => [foreignKey] => Array (  => test [trial_code] => test_code ) ) )