Auto-include module models?

I seem to be having an issue with module models not being included automatically. A good example is the user module, with a Users model, referenced within the UserIdentity authentication script. It gives the error:

Which is unfortunately a very broad error that can happen for many, many reasons.

If I explicitly add ‘application.modules.user.models.*’ to the import array, it’ll find it just fine. But the previous Yii project I worked on didn’t have anything like that, it just required that the module be added to the ‘modules’ array, below gii (which I have done). As best I can tell (based on the contents of UserModule.php), the module should be loading its own models as soon as it’s needed. I’ve compared their configuration to mine, and I can’t for the life of me figure out why it’s not auto-loading these models. Anyone got any idea?

Check the protectd/config/main.php "import" section…

Yeah, that normally contains the following:


'application.models.*',

'application.components.*'

And if I add ‘application.modules.user.models.*’, it works fine. But the other site I worked on didn’t have to do that, so it seems odd that I would need to.

Strange… maybe the full path was used in the modules config?

Not that I can see. Oh well, I was just concerned because I thought I’d done something quite wrong. If I’m supposed to put the module model includes in to the ‘imports’ array, then I’m fine with that. Thank you for the quick response :)