[eluser]Unknown[/eluser]
Hiya,
I'm from a traditional OOP background, and despite having read the user manual and tutorials, I'm still having a few issues getting my head around CodeIgniter's MVC approach and how my system architecture should be structured.
To give a slightly simplified example…
If I have a Product that can have an arbitrary number of Images associated to it. Traditionally I would have had a ProductClass and an ImageClass, and if I wanted to get the images for the current Product, I could just call $objProduct->getImages() which would return an array of ImageClass objects by calling ImageClass::get_images_for_product($idProduct).
Now as far as I can tell with CodeIgniter, when you use ActiveRecord in your model to load a record, it is returned as stdClass object (and so with no methods) rather than an instance of your class object. Also, it seems you're not really meant to access one model from within another.
Both of these issues mean I need to be doing this sort of thing differently to the above method, but I'm not really sure what the best way is - any suggestions?
Many thanks!
Pete