Welcome Guest, Not a member yet? Register   Sign In
Modelling Questions
#8

[eluser]tonanbarbarian[/eluser]
After looking more at the loader class code I can see what the issue is with extending the Model class.
The model method which is used to load a model is not designed in such a way to allow the Model class to be extended correctly

To fix this you can do 1 of 2 things
1. Hack the system/libraries/Loader.php
change line 159
Code:
require_once(BASEPATH.'libraries/Model'.EXT);
to
Code:
load_class('Model', false);

or create an extension to the loader to do it for you
application/libraries/MY_Loader.php
Code:
<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');
class MY_Loader extends CI_Loader {

    /**
     * Constructor
     */
    function MY_Loader() {
        parent::CI_Loader();
    } // MY_Loader()

    /**
     * Model Loader
     *
     * This function lets users load and instantiate models.
     * Overridden so that the Model is loaded correctly and can be extended
     *
     * @access  public
     * @param   string  the name of the class
     * @param   mixed   any initialization parameters
     * @return  void
     */
    function model($model, $name = '', $db_conn = FALSE) {
        // load the Model class correctly so it can be extended
        if (!class_exists('Model')) {
            load_class('Model', false);
        }
        parent::model($model, $name, $db_conn);
    } // model()

} // class MY_Loader

I will be reporting this as a bug if it hasnt been already


Messages In This Thread
Modelling Questions - by El Forum - 11-29-2007, 12:14 PM
Modelling Questions - by El Forum - 11-29-2007, 01:44 PM
Modelling Questions - by El Forum - 12-01-2007, 10:19 AM
Modelling Questions - by El Forum - 12-01-2007, 11:35 PM
Modelling Questions - by El Forum - 12-02-2007, 09:42 PM
Modelling Questions - by El Forum - 12-02-2007, 11:40 PM
Modelling Questions - by El Forum - 12-03-2007, 12:28 AM
Modelling Questions - by El Forum - 12-04-2007, 07:55 PM
Modelling Questions - by El Forum - 12-04-2007, 11:11 PM
Modelling Questions - by El Forum - 12-04-2007, 11:55 PM
Modelling Questions - by El Forum - 12-05-2007, 12:39 AM
Modelling Questions - by El Forum - 11-30-2008, 07:11 AM
Modelling Questions - by El Forum - 11-30-2008, 11:29 AM



Theme © iAndrew 2016 - Forum software by © MyBB