[Dbix-class] RFC - has_subset
Matt S Trout
dbix-class at trout.me.uk
Sun Apr 6 20:57:28 BST 2008
On Mon, Mar 31, 2008 at 12:45:04PM +0100, Daniel Ruoso wrote:
> 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 of
> the 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
So you have one has_many, 'files', and a custom resultset class providing
'input' and 'output' methods.
I don't see how this is a relationship/component?
--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director http://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://chainsawblues.vox.com/ http://www.shadowcat.co.uk/servers/
More information about the DBIx-Class
mailing list