Creating models without DB tables

I’m a bit confused at the moment. I’m fine with using the yiic tool and the crud command to generate models, views and controllers for models with the databases.

At the moment, however, I’m working on a very simple image uploader form. I’m following this tutorial: http://www.yiiframework.com/doc/cookbook/2/

From my understanding it assumes that you’ve “crud’d” a model, view and controller, however, as mentioned above I don’t need an ActiveRecord model for this, so I don’t think that would be appropriate.

I’m not sure if I’m presented myself clearly here (I’m having trouble explaining what I want). If anyone has any ideas, I’d appreciate some guidance. If you’re having trouble understanding exactly what I want, ask for clarification.

You can use a CFormModel instead of CActiveRecord. It provides the same validation mechanisms as AR.

If that was your question … ;)

Yeah, but I was wondering if there’s anyway for yiic to generate all the required files. At the moment, I’ve created the model, view and controller manually but I’m not sure how to actually add it into the system.

If the model files are in the currently dir, and they defined without error, you can call them in everywhere~

I’ve created the files (m, v & c). However what I’m unsure of now is how to access the form through the website? Will Yii look and realize there’s a form called XYZ? If so, what will the URL to access it be? If not, what do I have to do to get Yii to recognize that it’s a form?

That’s what you need to do in the Controller. Either take a CRUD generated controller as template or build your own from scratch. Yii doesn’t look for automatically…