Welcome Guest, Not a member yet? Register   Sign In
loading model return value??
#1

[eluser]zilverdistel[/eluser]
I'd like to know what return value to expect when loading a model like this:

Code:
$user1 = $this->load->model('user_model');
#2

[eluser]xwero[/eluser]
No value. if there is an error the model doesn't get loaded. If you want to check if the model is loaded witout looking at the log you can do
Code:
if(!class_exists('user_model'))
{
   // error
}
else
{
  // success
}
#3

[eluser]zilverdistel[/eluser]
so, if a model doesn't get loaded, CI does not interrupt the execution process?
#4

[eluser]xwero[/eluser]
[quote author="diederik vandamme" date="1204910002"]so, if a model doesn't get loaded, CI does not interrupt the execution process?[/quote]
no
#5

[eluser]zilverdistel[/eluser]
i find that bizar... most CI methods return false if something fails. Is there a reason for this? If not, it might be an interesting feature for future releases.
#6

[eluser]xwero[/eluser]
It's not that strange Because the only time you are going to get errors is when you are in the development phase and then you use the log to track errors. Even if you are in a rush and you don't have the time to do tests, which you should, you are not going to write code direct on the production server.

If there would be checks everywhere the application/website would run slow.
#7

[eluser]zilverdistel[/eluser]
that's fair enough, tnx xwero




Theme © iAndrew 2016 - Forum software by © MyBB