Get model attribute's type in Yii2

How can I check type (column type) of model’s attribute in Yii2?

This old answer gave me a conclusion, that in Yii1 I can use something like that:


But I was unsuccessful in porting this solution to Yii2. Can someone help?

You can use:




and then read dbType, phpType or type, according to what… type of type you’re looking for.

For example:


Founded this myself in exactly the same time as cetver does! :>