public function get_role_overrides_from_data(\stdClass $data) {
        $overrides = [];
        if (!empty($data->overrides)) {
            $searchkey = 'roleoverride_';

            for ($i = 0; $i < $data->overrides; $i++) {
                $overridedata = (object) [];
                foreach ((array) $data as $fieldname => $value) {
                    if (strpos($fieldname, $searchkey) !== 0) {
                        continue;
                    }

                    $overridefieldname = substr($fieldname, strlen($searchkey));
                    $overridedata->$overridefieldname = $value[$i];
                }

                if (empty($overridedata->roleid) || empty($overridedata->retentionperiodnumber)) {
                    // Skip this one.
                    // There is no value and it will be delete.
                    continue;
                }

                $override = static::convert_fields($overridedata);

                $overrides[$i] = $override;
            }
        }

        return $overrides;
    }
public function get_role_overrides_from_data(\stdClass $data) {
        $overrides = [];
        if (!empty($data->overrides)) {
            $searchkey = 'roleoverride_';

            for ($i = 0; $i < $data->overrides; $i++) {
                $overridedata = (object) [];
                foreach ((array) $data as $fieldname => $value) {
                    if (strpos($fieldname, $searchkey) !== 0) {
                        continue;
                    }

                    $overridefieldname = substr($fieldname, strlen($searchkey));
                    $overridedata->$overridefieldname = $value[$i];
                }

                if (empty($overridedata->roleid) || empty($overridedata->retentionperiodnumber)) {
                    // Skip this one.
                    // There is no value and it will be delete.
                    continue;
                }

                $override = static::convert_fields($overridedata);

                $overrides[$i] = $override;
            }
        }

        return $overrides;
    }
public function get_role_overrides_from_data ( \ stdClass $ data ) { $ overrides = [ ] ; if ( ! empty ( $ data -> overrides ) ) { $ searchkey = 'roleoverride_' ; for ( $ i = 0 ; $ i < $ data -> overrides ; $ i ++ ) { $ overridedata = ( object ) [ ] ; foreach ( ( array ) $ data as $ fieldname => $ value ) { if ( strpos ( $ fieldname , $ searchkey ) !== 0 ) { continue ; } $ overridefieldname = substr ( $ fieldname , strlen ( $ searchkey ) ) ; $ overridedata -> $ overridefieldname = $ value [ $ i ] ; } if ( empty ( $ overridedata -> roleid ) || empty ( $ overridedata -> retentionperiodnumber ) ) { // Skip this one. // There is no value and it will be delete. continue ; } $ override = static :: convert_fields ( $ overridedata ) ; $ overrides [ $ i ] = $ override ; } } return $ overrides ; }
Fetch the role override data from the list of submitted data.

@param   \stdClass   $data The complete set of processed data
@return  \stdClass[] The list of overrides
Fetch the role override data from the list of submitted data .