chapter6, page 123

On the bottom of this page, this line is in Project model.

$usersArray = CHtml::listData($this->users, ‘id’, ‘username’);

Would it be a good idea using CHtml in Model? I thought CHtml is a VIEW helper class.

I think, there is no urgent. It is a helper class. You can use whenever u want(not only for view).

listData method just return array that can be used directly in CHtml::dropdown method or other methods, so you can use it freely in your model, without braking any MVC rules.