Jump to content

Changing vars of parent class?


amites

Recommended Posts

Hello,

 

I am attempting to build a function to add multiple arrays to a class var, I am attemting to do this from within an extension of that same class,

 

the following is Code Igniter code with comments, it sets $this->_form_data properly trick is that it is loaded into a seperate object


class MultiValid extends CI_Form_validation {
    function multi_rules($group = '') {

// Loads the array
        $this->CI->config->load('form_validation', TRUE);
        $rules = $this->CI->config->item('form_validation');
        
        $set = false;
        if (is_array($group)) {
            foreach ($group as $grp) {
                
                if ($grp != '' && isset($rules[$grp])) {
                    
                    $this->set_rules($rules[$grp]);
                    $set = true;
                }
            }
        }
        
        return $set;
    }
}

 

This code is loaded as $this->multidataa

which fills $this->multidata->_form_data with values

 

what I'd like to set is $this->form_validation->_form_data

as it is a native library to CI and referenced regularly through other classes

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/138383-changing-vars-of-parent-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.