EllisLab text mark
Advanced Search
     
CodeIgniter 2.0 - Class ‘Model’ not found
Posted: 04 July 2010 11:37 AM
Joined: 2009-07-08
9 posts

Hi, I try to do something very simple, but can’t get it to work..
I downloaded the latest rev of CI from bitbucket.

Created one model, and one controller..

When i try to run, I get this error:

Fatal error: Class ‘Model’ not found in /Applications/MAMP/htdocs/application/models/customer.php on line 3


In rev 1.7.2, this would work.. But is there something I have forgotten to do, or what..?


Regards.

 
Posted: 04 July 2010 11:45 AM   [ # 1 ]   [ Rating: 0 ]
Avatar
Joined: 2007-03-10
451 posts

Try reading Phil Sturgeon’s upgrade to CI2.0 guide on his blog.

Bottom line: Model has been renamed to CI_Model and you should change “extends Model” to “extends CI_Model”.

 Signature 

Starting with CodeIgniter setup
Senior dev of FuelPHP

 
Posted: 02 February 2011 01:41 AM   [ # 2 ]   [ Rating: 0 ]
Joined: 2011-02-02
1 posts

Make the following changes in your model to make it work in Codeigniter 2.0.

Change

class Category_model extends Model {
....................
}

TO

class Category_model extends CI_Model {
....................
}

——————————-

Also Change

function _construct()
{
      // Call the Model constructor
      parent::Model();
}

TO

function _construct()
{
      // Call the Model constructor
      parent::_construct();
}

Hope this helps ...