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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.