multiple elements call same models |
[eluser]Lenouv[/eluser]
Hello. Sorry for my english, i'm a newbie in english like in codeigniter. I'm french and the french community is dying. I'm using codeigniter for a professional project (10k€). I'm using the double linked list with heritage in order to manipulate the datas: controller Listmanager extends CI_Controller controller Listelement extends CI_Controller with a database table 'list' and a model Listelement_model controller Typemanager extends Listmanager controller Typeelement extends Listelement with a database table 'type' and a model Typeelement_model. It's just an example. When i want to update two or more elements, this bug appears: The first typeelement call the model list method and the model type method in order to save it. It works. The second typeelement call the model list or type ... and this error appears: Severity: Notice Message: Undefined property: Typeelement::$Listelement_model Filename: controllers/listelement.php Line Number: 77 my code : Code: $this->load->model(array('Listelement_model')); The only way i found is to rename the model object like this : http://ellislab.com/codeigniter/user-gui...ml#loading But ... i will have to work with more than 2 or 3 elements in the list, how can i in order to not rename the model object every time i need to insert or update a element? Thx bye.
[eluser]Lenouv[/eluser]
Re- The "only" way i found doesn't work :/ How i do it: - I generate an aleatory name for the model depends on the list_id of the element - I call the model with this new model_name - I call the model function to save or update element. My code: Code: public function _save($list_id = NULL){ How can I do?
[eluser]jvicab[/eluser]
I am not sure what your intention is using: $this->load->model(array('Listelement_model')); If you explain to me what you need to be done, I would help you to find another way to get it done.
[eluser]Lenouv[/eluser]
Sorry i not using array('listelement_mdel'), it's just a test. I'm found another way yesterday but this is lower. |
Welcome Guest, Not a member yet? Register Sign In |