[Dbix-class] Adding relationships to an already-constructed schema
Toby Corkindale
toby.corkindale at strategicdata.com.au
Thu Apr 2 03:56:33 BST 2009
Hi,
Start by assuming I'm smoking crack and do actually want to do this.. :)
If I have a $schema that is already initialised, and I decide I want to
add a new relationship to one of my tables, what is the proper way to do
so?
Is it this?
my $schema = ExampleApp->connect(..);
my $result_source = $schema->source('FooBar');
$result_source->has_many(something => 'ExampleApp::Wotsits');
Or perhaps this?
my $schema = ExampleApp->connect(..);
my $class = $schema->class('FooBar');
$class->has_many(something => 'ExampleApp::Wotsits');
I have my suspicions that neither are correct though.
Thanks in advance, and I'll pass the crack-pipe on now and go back to
wondering about how to re-engineer this to not require dynamic
relationships at all..
Toby
More information about the DBIx-Class
mailing list