Gii Crud Generator Not Working (Advanced Template)

I’m trying to use the Gii CRUD generator (advanced template), but it’s not working. This is what I get:




Class 'backend\models\Category' does not exist or has syntax error.



The model exists, and has no syntax errors, since I can use it for all other occasions.

I’ve tried entering ‘models\Category’ as well as just ‘Category’ in the Model Class field, but I get this error every time. Any suggestions?

Solved it!

When i used Gii to create the model class, i forgot to change the pre-filled namespace in the Gii Generator field for the Category model from ‘app\models’ to ‘backend\models’.

Since ‘app\models’ is automatically filled even if you’re using the advanced template, this is maybe something for the developers to take a look at?

I had a similar problem, though in this case I was trying to create from frontend/models/User.

Apparently Gii doesn’t like doing this. I could see the file was definitely being read so it was a bit of a weird one.

When I specified one of my own defined tables, it worked fine using that syntax.

They must have listened to your feedback. The updated version of Gii uses the correct path for the advanced template.

I was having the same problem with the advanced template in 2.0.2. The name space defaults to app\models and changing it to frontend\models worked fine.

Gracias!