Author: spadkins
Date: Sat Nov 15 15:01:50 2008
New Revision: 12078
Modified:
p5ee/trunk/App-Context/lib/App/Context.pm
Log:
make repository classes a bit easier to configure
Modified: p5ee/trunk/App-Context/lib/App/Context.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Context.pm (original)
+++ p5ee/trunk/App-Context/lib/App/Context.pm Sat Nov 15 15:01:50 2008
@@ -839,7 +839,15 @@
# Extended Services: provided in the App-Widget and App-Repository
distributions
# this is kind of cheating for the core to know about the extensions, but OK
sub template_engine { my $self = shift; return
$self->service("TemplateEngine",@_); }
-sub repository { my $self = shift; return
$self->service("Repository",@_); }
+sub repository {
+ my ($self, $name, @opts) = @_;
+ my $options = $self->{options};
+ my $key = "$name.dbclass";
+ if ($options->{$key}) {
+ $self->{conf}{Repository}{$name}{class} = $options->{$key};
+ }
+ return $self->service("Repository", $name, @opts);
+}
sub widget {
my $self = shift;
my @args = @_;