0

I've got 2 models with the same name, but in different folders.

models
   |
   - model1
        |
        - db_model.php
   |
   - model2
        |
        - db_model.php

When I load them like this it causes a problem:

$this->load->model('model1/db_model', 'db_model1');
$this->load->model('model2/db_model', 'db_model2');
8
  • I think you should give different names while you are loading Commented Feb 5, 2013 at 4:50
  • yeah, i think i should. but anyway, it's strange, 'cause i provide different name as second var. Commented Feb 5, 2013 at 4:52
  • what happen when $this->load->model('model2/db_model', 'db_model2'); ? Commented Feb 5, 2013 at 5:07
  • @eicto, the previous model stays loaded Commented Feb 5, 2013 at 5:58
  • you want to unload it ? Commented Feb 5, 2013 at 6:05

1 Answer 1

1

The 'db_model' is an alias, so you are naming them both the same thing.

Are you doing that for a reason? Explain what you want and we'll help with a workaround

Sign up to request clarification or add additional context in comments.

2 Comments

No reason. They just named the same but located in different folders. I wonder why I can't load them that way, providing another alias as second parameter.
you should be able to. you are giving them both the same alias, is your problem The system loads them by the alias name, and no longer realizes they are in two different folders.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.