A boolean method which tells if arow is in a subset: $row->is_output $row->is_input
$row->subset (returns input or output) Am 31.03.2008 um 13:45 schrieb Daniel Ruoso:
Hi, I'm working on an application that have the following classes: TaskType --- has_many ---> TaskTypeFile but, that can actually be seen as two relationship types: ____ has_many { type => input } __ / \ TaskType TaskTypeFile \____ has_many { type => output }__/ Or, this could be seen as: TaskTypeFile /\ /\ | | is is | | InputFile OutputFile _______ has_many__/ | / | TaskType --------------- has_many ------/ But one could see InputFile and OutputFile simply as a subset of TaskTypeFile, and once this is done, we can keep the simplicity ofthe first diagram, and filter on the TaskTypeFile as needed, which also enables the input/output view independent on the TaskType relationship.So, instead of doing $tasktypers->input_files $tasktypers->output_files I could do $tasktypers->files->input $tasktypers->files->output The major difference in that is that I can do my $rs = TaskType->find($id, { prefetch => 'files' }); while ($rs->files->input) {...} while ($rs->files->output) {...} With a single query, as the input/output resultset would simply implement a filter on the previous resultset, while TaskTypeFile->input->search({ name => 'foo.txt' }); would still be possible. So, the proposed interface is: __PACKAGE__->load_components( ... Subset ... ); ... __PACKAGE__->has_subset('input', { type => 'input' }); __PACKAGE__->has_subset('output', { type => 'output' }); It would add that as a part of the where clause when no cache is present, and grep on the cache when already prefetched... I still didn't go through the coding, so, this is the time for any comments or tomatoes... daniel _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
_______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
