Welcome Guest, Not a member yet? Register   Sign In
Getting my head around CI's MVC approach (from a traditional OOP perspective)
#1

[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


Messages In This Thread
Getting my head around CI's MVC approach (from a traditional OOP perspective) - by El Forum - 07-16-2010, 03:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB