Welcome Guest, Not a member yet? Register   Sign In
Model not Found
#1

[eluser]Unknown[/eluser]
Hi guys,

I'm new with CI and i trying to just create a model and load it from controller. When i do it, i got the following error:

Class 'Pessoa_model' not found in C:\xampp\htdocs\flightManager\system\core\Loader.php on line 303

Following is the code from Controller:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

public function index()
{
  $this->load->model('pessoa_model', 'pessoa');
}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
?>

And from Model:

Code:
<?php
namespace application\models;

class Pessoa_model extends \CI_Model {


function __construct() {
  parent::__construct();
}
}
?>

PS:. Btw, ZendStudio is putting a '\' before CI_Model. If i remove the '\', the error became: Fatal error: Class 'application\models\CI_Model' not found in C:\xampp\htdocs\flightManager\application\models\pessoa_model.php on line 4

What am i doing wrong?

Thanks
#2

[eluser]bobbob[/eluser]
Just to clarify you have a file called pessoa_model.php in Application/models that has the model code you posted?

Then can you start without the namespace and see what you get and if you can remove that slash in front of CI_Model that will help.
#3

[eluser]Unknown[/eluser]
[quote author="bobbob" date="1349151254"]Just to clarify you have a file called pessoa_model.php in Application/models that has the model code you posted?

Then can you start without the namespace and see what you get and if you can remove that slash in front of CI_Model that will help.[/quote]

Thank you very much. That was the error. ZendStudio is automatically putting the namespace in the file and that was messing everything.




Theme © iAndrew 2016 - Forum software by © MyBB