Class 'CHtml'

Hello community I need to implement the method Chtml, since I am implemented this class, but no himself where it takes effect you generate this error to me:

 PHP Fatal Error – yii\base\ErrorException

Class 'CHtml' not found

in this piece of code:

echo CHtml::dropDownList('incmay', '', CHtml::listData(Cmayorista::model()->findAll(array('order' => 'Descripcion DESC')), 'IdMay', 'Descripcion'));


I need to solve this, you would thank them his valuable help, since I was in favor of 2 years in yii1.1 and now I am beginning with Yii2


In Yii 2, we have Html::dropDownList() instead of CHtml::dropDownList(), and you have to use ArrayHelper::map() in place of CHtml::listData().

Please refer to the API document.

Html::dropDownList() (

Ok thank you for responding, you would be able to fix this code where you give me error