public function nested_table($instance_name = '', $field = '', $inner_tbl = '', $tbl_field = '')
    {
        if ($instance_name && $field && $inner_tbl && $tbl_field)
        {
            $fdata = $this->_parse_field_names($field, 'nested_table');
            foreach ($fdata as $fitem)
            {
                $this->inner_table_instance[$instance_name] = $fitem['table'] . '.' . $fitem['field']; // name of nested object will be stored in parent instance
                $instance = Fruit::get_instance($instance_name); // just another fruit object
                $instance->table($this->prefix . $inner_tbl);
                $instance->is_inner = true; // nested flag

                $fdata2 = $this->_parse_field_names($tbl_field, 'nested_table', $inner_tbl);

                $instance->inner_where[$fitem['table'] . '.' . $fitem['field']] = key($fdata2); // this connects nested table with parent
                return $instance; // only one cycle
            }
        }
    }
public function nested_table($instance_name = '', $field = '', $inner_tbl = '', $tbl_field = '')
    {
        if ($instance_name && $field && $inner_tbl && $tbl_field)
        {
            $fdata = $this->_parse_field_names($field, 'nested_table');
            foreach ($fdata as $fitem)
            {
                $this->inner_table_instance[$instance_name] = $fitem['table'] . '.' . $fitem['field']; // name of nested object will be stored in parent instance
                $instance = Fruit::get_instance($instance_name); // just another fruit object
                $instance->table($this->prefix . $inner_tbl);
                $instance->is_inner = true; // nested flag

                $fdata2 = $this->_parse_field_names($tbl_field, 'nested_table', $inner_tbl);

                $instance->inner_where[$fitem['table'] . '.' . $fitem['field']] = key($fdata2); // this connects nested table with parent
                return $instance; // only one cycle
            }
        }
    }
public function nested_table ( $ instance_name = '' , $ field = '' , $ inner_tbl = '' , $ tbl_field = '' ) { if ( $ instance_name && $ field && $ inner_tbl && $ tbl_field ) { $ fdata = $ this -> _parse_field_names ( $ field , 'nested_table' ) ; foreach ( $ fdata as $ fitem ) { $ this -> inner_table_instance [ $ instance_name ] = $ fitem [ 'table' ] . '.' . $ fitem [ 'field' ] ; // name of nested object will be stored in parent instance
 $ instance = Fruit :: get_instance ( $ instance_name ) ; // just another fruit object
 $ instance -> table ( $ this -> prefix . $ inner_tbl ) ; $ instance -> is_inner = true ; // nested flag
 $ fdata2 = $ this -> _parse_field_names ( $ tbl_field , 'nested_table' , $ inner_tbl ) ; $ instance -> inner_where [ $ fitem [ 'table' ] . '.' . $ fitem [ 'field' ] ] = key ( $ fdata2 ) ; // this connects nested table with parent
 return $ instance ; // only one cycle
 } } }
nested table constructor
nested table constructor