In essence, I agree with what you're saying...

in my base class i have:

relationships (
        privacy_override__subordinates=> {
                class=> 'Overrides',
                key_columns=> { id=> 'id__viewed_by' },
                type=> 'one to one',
        },
        privacy_override__limiteds=> {
                class=> 'Overrides',
                key_columns=> { id=> 'id' },
                type=> 'one to one',
        },
)

the 'advanced' join happens on one of those relationships.  the  
problem however, is that while the conditions are set forth in the  
relationships item, the parameters would have to be specced in a manager

        ie:
                get me all links from person A, and take into account overrides
                there would have to be a placeholder in the relationships for  
'personA'

fwiw, my interim solution is a bastardized manager item, where i do a  
base query,  then do a manager class query in the overrides table,  
loop through them, and merge them into my base query results where  
appropriate

I get the effect of what a conditional join would have done, with a  
performance hit, but i can still use rose db

sub get_items__with_overrides {
        my ( $class, %args )= @_ ;
        my      $results;
        eval {
                $results= $class->get_items(
                        query=> [
                        id=> $args{'id'} ,
                        ],
                        db=> $args{'db'},
                );
                
                # then we fetch the overrides
                my      $overrides= 
Overrides::Manager->get_subordinate_overrides(
                        id=> $args{'id'} ,
                        db=> $args{'db'},
                );
                
                # merge them
                OUTER:  foreach my $override ( @{$overrides} ) {
                                INNER:  foreach my $result ( @{$results} ) {
                                                if ( $override->id__viewed_by 
== $result->id ) {
                                                        
$result->{'privacy_override__subordinates'}= $override;
                                                        next OUTER;
                                                }
                                        }
                                }
        };
        if ( $@ ) { print STDERR $@; }
        return $results;
}



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to