• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extending the native Model in Codeigniter 2

EDIT: Fixed - should have been in /application/core

I successfully extended the Form_validation library by creating a MY_Form_validation.php in /application/libraries/ - but I can't get the same thing to work with a model.

Error message:
Quote:PHP Fatal error: Class 'MY_Model' not found in /Users/wt ...../application/models/gifts_model.php on line 2

Where /application/models/gifts_model.php has:

class Gifts_model extends MY_Model {

    var $table = 'gifts';

    function Gifts_model() {
        // call the model constructor

and /application/libraries/MY_Model.php (which I've also tried putting in the /models/ directory) begins:


class MY_Model extends CI_Model {

    function MY_Model()

I assume I've missed something stupid - any ideas?


In 2.0, when extending core classes they must go in application/core, not application/libraries

edit: Whoops, just saw you figured this out

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.