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

[eluser]paulkmoore[/eluser]
n0xie / Dan

Many thanks for the prompt replies - I really appreciate it.

Addressing the responses somewhat in turn:

n0xie - this would and does work but requires me to define the array of strings up front. I'm trying to load a number of detail records and don't know how many I'll have in advance. I appreciate that this would give the load->model function a string to work with however.

Dan - agree with your EDIT - the Loader.php allows for a unique name. To respond to the 'why would you want to do this point' I am using the models as objects to represent the table rows. i.e. each model has a set of properties (the columns from the table) and methods to get/set from the database, and any other methods appropriate to the object.

I hear (somewhat) the point about efficiency but to be honest the Model doesn't seem to be much overhead (given analysis of the Loader.php) and frankly if I create other objects that then instantiate the model(s) I'll be in a not dissimilar position.

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.

I'll take a more detailed look at your proposed example and get back to you.

Thanks both

Paul


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



Theme © iAndrew 2016 - Forum software by © MyBB