is=>'ro',
isa=>'ClassName',
required=>1,
- default=>'DBIx::Class::Storage::DBI::Replicated::Replicant',
+ default=>'DBIx::Class::Storage::DBI',
handles=>{
'create_replicant' => 'new',
},
);
-
=head2 replicants
A hashref of replicant, with the key being the dsn and the value returning the
has 'replicants' => (
is=>'rw',
metaclass => 'Collection::Hash',
- isa=>'HashRef[DBIx::Class::Storage::DBI::Replicated::Replicant]',
+ isa=>'HashRef[DBIx::Class::Storage::DBI]',
default=>sub {{}},
provides => {
'set' => 'set_replicant',
},
);
-
=head1 METHODS
This class defines the following methods.
=cut
+use Data::Dump qw/dump/;
+
sub connect_replicants {
my $self = shift @_;
my $schema = shift @_;
my @newly_created = ();
foreach my $connect_info (@_) {
+
my $replicant = $self->create_replicant($schema);
- $replicant->connect_info($connect_info);
+ $replicant->connect_info($connect_info);
$replicant->ensure_connected;
+
+ DBIx::Class::Storage::DBI::Replicated::Replicant->meta->apply($replicant);
+
my ($key) = ($connect_info->[0]=~m/^dbi\:.+\:(.+)$/);
$self->set_replicant( $key => $replicant);
push @newly_created, $replicant;
return @newly_created;
}
-
=head2 connected_replicants
Returns true if there are connected replicants. Actually is overloaded to
return values %{$self->replicants};
}
-
=head1 AUTHOR
John Napiorkowski <john.napiorkowski@takkle.com>
=cut
-
-1;
\ No newline at end of file
+1;