[Dbix-class] "regression" introduced in DBIC r5298.. Or we're Doing It Wrong..

Matt S Trout dbix-class at trout.me.uk
Mon Jun 8 19:28:21 GMT 2009


On Wed, Jun 03, 2009 at 06:14:13PM +1000, Toby Corkindale wrote:
> Hi guys,
> I've encountered a regression in DBIC, introduced in revision 5298.
> It's more than likely that the way things were being done in the code 
> here were not correct and *shouldn't* have worked previously, but I 
> can't seem to work it out myself.
> 
> There's a single changed line which triggers the problem:
> --------------------------------------------------------
> diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm
> @@ -1228,7 +1229,7 @@ sub register_extra_source {
>  sub _register_source {
>    my ($self, $moniker, $source, $params) = @_;
> 
> -  %$source = %{ $source->new( { %$source, source_name => $moniker }) };
> +  $source = $source->new({ %$source, source_name => $moniker });

Yeah, that's a bugfix.

Basically, you can't add relationships after the fact - if you can't set up
your relationships before the source is registered with the schema then
you'll need to re-register it afterwards.

Slightly annoying side effect of the prototype inheritance style DBIC uses
for schema and sources - I'm aware it's a tad annoying but things break
subtly without it.

-- 
        Matt S Trout         Catalyst and DBIx::Class consultancy with a clue
     Technical Director      and a commit bit: http://shadowcat.co.uk/catalyst/
 Shadowcat Systems Limited
  mst (@) shadowcat.co.uk        http://shadowcat.co.uk/blog/matt-s-trout/



More information about the DBIx-Class mailing list