On 4/11/07, Derek Watson <[EMAIL PROTECTED]> wrote: > What I really want to be able to do is (using an m-to-m's add_on_save) > > my $item = My::DBO::Item->new(); > $package->add_items($item); # related by an m-to-m with add_on_save > $item->map_record->notes('save me too'); # does map_record even exist yet? > $package->save;
The purpose of the map_record method is just to provide a place to hold a map record when fetching objects related through a m-to-m relationship. The flow really doesn't go in the other direction. M-to-m relationships exist to provide the appearance of a single relationship where two chained relationships actually exist by ignoring the "middle" table, which is considered unimportant beyond its function of mapping from one table to another. Once you decide that the middle table *is* important (i.e., you decide you want to actually manually set some extra info on those records) then you have to either save first and then fetch (which fits into the map_record() method's limited role as a "holder for fetched things"), or traverse the "real" 1-to-m -> m-to-1 relationship chain that the m-to-m relationship is standing in for. (Keep in mind that you can have both the m-to-m and the equivalent 1-to-m -> m-to-1 chain defined, using whichever is most appropriate for a given task.) -John ------------------------------------------------------------------------- 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