Welcome Guest, Not a member yet? Register   Sign In
Models that use other models? array of models? objects?? a case study
#3

[eluser]avastreg[/eluser]
Code:
-- --------------------------------------------------------

CREATE TABLE IF NOT EXISTS `my_products` (
  `id` int(11) NOT NULL auto_increment,
  `name` text NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COMMENT='product table' AUTO_INCREMENT=614 ;

-- --------------------------------------------------------

CREATE TABLE IF NOT EXISTS `my_link_actions` (
  `link_id` int(11) NOT NULL,
  `actions` varchar(255) NOT NULL COMMENT '\n- added\n- created \n- completed\n- uncompleted',
  `date` datetime NOT NULL,
  `source_ip` varchar(255) default NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY  (`product_id`,`operation`,`date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8


Here it is. The core of the problem is: if i have to list the products, and ideally a product (with its actions history) can be a model, how i have to manage this list??

I must call the Product_model for each product, so in the end i have an array of products?

Reading about models i find that almost in every case there is one model, one controller and one or more views.

I need those products as instances of the model! But many instances, because the classical instance retrieved by $this->load->model('Product_model'); is not enough. How i can do?


Messages In This Thread
Models that use other models? array of models? objects?? a case study - by El Forum - 05-03-2009, 11:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB