I’m a complete beginner with Yii, so apologies up front for any ignorance on the matter.
I followed the tutorial for the first Yii app and then decided to add a second model to the testdrive app. This all went well, however one of the properties of the new model refers to a column with an ENUM datatype for which I wanted to generate a dropdown list as opposed to the default text field.
I found this post and implemented class [font="Courier New"]ZHtml[/font] in [font="Courier New"]ZHtml.php[/font] as described in the post. I put [font="Courier New"]ZHtml.php[/font] in [font="Courier New"]testdrive/protected/components[/font].
Next I modified my [font="Courier New"]_form.php[/font] file for my newly created model with the [font="Courier New"]enumDropDownList[/font], as suggested in the post:
<div class="row"> <?php echo $form->labelEx($model,'calculateDeposit'); ?> <?php echo ZHtml::enumDropDownList($model, 'calculateDeposit'); ?> <?php echo $form->error($model,'calculateDeposit'); ?> </div>
When I run the app, I see a stack trace in the logs complaining that ZHtml was not found:
PHP Fatal error: Class 'ZHtml' not found in /Applications/MAMP/htdocs/testdrive/protected/views/property/_form.php on line 50
From my config file I see the following, suggesting that my new file should be available as autoload:
// autoloading model and component classes 'import'=>array( 'application.models.*', 'application.components.*', ),
I’m obviously missing something. Any help is appreciated…