Welcome Guest, Not a member yet? Register   Sign In
Populating an array of objects using CI's load->model() functionality
#5

[eluser]Dan Horrigan[/eluser]
[quote author="paulkmoore" date="1271885581"]n0xie / Dan
I am trying to create something of a container class that will manage the header and multiple details records, and frankly I'm not sure whether this should be a Model or not. It's certainly not a Controller and doesn't feel like a library. Perhaps I should create a business_objects directory or similar - but I somewhat concerned about moving from the existing MVC primitives.
[/quote]

A library is your best bet (a library is just a fancy name for a class anyway). Create a Details class that has all the properties you need. Then your container class can have an array of Detail classes. Each Details object would be a row from the database. The libraries can access the models that actually interface with the db (as long as you use use the get_instance() function).

Because the 2 classes are so closely tied, you can keep them both in the same file, that way you just load 1 library into your controller.

Dan


Messages In This Thread
Populating an array of objects using CI's load->model() functionality - by El Forum - 04-21-2010, 10:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB