Gii crud script seems to be generating incorrect code

Hi folks

Getting odd results from the Gii crud generator.

Generated models for a few MySQL tables, and am now running the Gii crud script for the first time. The script runs to completion with no errors.

But the generated code seems incorrect and throws errors when I hit the "You may try it now" link. For example, the generated controllers start with the line:

class MyModelController extends Controller

Why is it trying to extend from "Controller"? This is surely incorrect?

But if I edit the extended class to “CController” the generated view starts asking for values that aren’t being passed by the generated Controller, for example:


I’ve had to change the default Yii file structure a little to meet my requirements, but my settings are working fine for manually created controllers and views, and Gii is placing its generated crud scripts on the right paths. So I’m baffled.

Any tips as to what’s going on here would be very much appreciated! New to Yii so please forgive me if I’m missing anything obvious…

Solved (sort of).

Seems that the Gii crud script is expecting a component called Controller.php (see demo sites) but doesn’t check that it exists or replace it if it’s missing. I’ll leave this post up for anyone that runs into the same issue.

I’m seeing other issues, but it seems that the crud script has a number of dependencies on the default generated site so I guess that’s where I should be looking. I’ll be back if that doesn’t solve things…

Did you solve this problem? I didn’t find any solution until now.