Class Not Found Fatal Error


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'); ?>


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





I’m obviously missing something. Any help is appreciated…

Please see this changeset and try adding this code to giix on your local copy.

Please report whether it works.

Thanks for the reply but I’m not using Giix… yet.

I was trying to get this to work without any addons just to get some understanding of Yii.

That’s a good approach. I was confused by the link you included :)

Then my suggestion is to restart your environment. Sometimes my filesystem gets laggy here, you may be experiencing the same.

Nope, restarting does not make any difference.

Any other ideas on what can be wrong??

Solved it. I forgot to put the <?php and ?> delimiters in my class file…

It happens. Are you using an IDE?