public static function get_overrides_for_purpose(purpose $purpose) : array {
        $cache = \cache::make('tool_dataprivacy', 'purpose_overrides');

        $overrides = [];
        $alldata = $cache->get($purpose->get('id'));
        if (false === $alldata) {
            $tocache = [];
            foreach (self::get_records(['purposeid' => $purpose->get('id')]) as $override) {
                $tocache[] = $override->to_record();
                $overrides[$override->get('roleid')] = $override;
            }
            $cache->set($purpose->get('id'), $tocache);
        } else {
            foreach ($alldata as $data) {
                $override = new self(0, $data);
                $overrides[$override->get('roleid')] = $override;
            }
        }

        return $overrides;
    }
public static function get_overrides_for_purpose(purpose $purpose) : array {
        $cache = \cache::make('tool_dataprivacy', 'purpose_overrides');

        $overrides = [];
        $alldata = $cache->get($purpose->get('id'));
        if (false === $alldata) {
            $tocache = [];
            foreach (self::get_records(['purposeid' => $purpose->get('id')]) as $override) {
                $tocache[] = $override->to_record();
                $overrides[$override->get('roleid')] = $override;
            }
            $cache->set($purpose->get('id'), $tocache);
        } else {
            foreach ($alldata as $data) {
                $override = new self(0, $data);
                $overrides[$override->get('roleid')] = $override;
            }
        }

        return $overrides;
    }
public static function get_overrides_for_purpose ( purpose $ purpose ) : array { $ cache = \ cache :: make ( 'tool_dataprivacy' , 'purpose_overrides' ) ; $ overrides = [ ] ; $ alldata = $ cache -> get ( $ purpose -> get ( 'id' ) ) ; if ( false === $ alldata ) { $ tocache = [ ] ; foreach ( self :: get_records ( [ 'purposeid' => $ purpose -> get ( 'id' ) ] ) as $ override ) { $ tocache [ ] = $ override -> to_record ( ) ; $ overrides [ $ override -> get ( 'roleid' ) ] = $ override ; } $ cache -> set ( $ purpose -> get ( 'id' ) , $ tocache ) ; } else { foreach ( $ alldata as $ data ) { $ override = new self ( 0 , $ data ) ; $ overrides [ $ override -> get ( 'roleid' ) ] = $ override ; } } return $ overrides ; }
Get all role overrides for the purpose.

@param   purpose $purpose
@return  array
Get all role overrides for the purpose .