aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
diff options
context:
space:
mode:
authoredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-01-30 17:24:56 +0000
committeredenc <edenc@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-01-30 17:24:56 +0000
commitd343ffacddd6357978db894d46c326f07beb48cb (patch)
tree8edd8d13ede1ebb55fee44bd45cad969b0f140cc /lib/Reaction/InterfaceModel/Reflector/DBIC.pm
parente39fcb0616feffa05dfd725eb4cde04d2aba8962 (diff)
parent8a293e2eee23938229a7dbfb617faee579914dfc (diff)
downloadreaction-d343ffacddd6357978db894d46c326f07beb48cb.tar.gz
reaction-d343ffacddd6357978db894d46c326f07beb48cb.zip
r20384@hades (orig r523): wreis | 2008-01-26 12:21:51 -0300
added CheckNumber type constraint r20385@hades (orig r524): wreis | 2008-01-26 12:28:01 -0300 unquoted Reaction::Types r20386@hades (orig r525): wreis | 2008-01-26 12:29:08 -0300 fixed assertion for _build_fields_for_type_Str r20397@hades (orig r531): matthewt | 2008-01-29 04:39:49 -0300 better error reporting on reflection failure for Object viewport r20398@hades (orig r532): matthewt | 2008-01-29 04:40:51 -0300 refactored value string building r20399@hades (orig r533): matthewt | 2008-01-29 08:11:06 -0300 -Debug is -stupid- r20400@hades (orig r534): wreis | 2008-01-29 08:26:17 -0300 fixed DBIC types r20401@hades (orig r535): matthewt | 2008-01-29 08:35:18 -0300 container widget r20402@hades (orig r536): wreis | 2008-01-29 23:41:25 -0300 added _class_to_attribute_name method r20405@hades (orig r539): matthewt | 2008-01-30 13:33:10 -0300 first cut of Reaction::UI::Skin and SiteLayout VP+widget
Diffstat (limited to 'lib/Reaction/InterfaceModel/Reflector/DBIC.pm')
-rw-r--r--lib/Reaction/InterfaceModel/Reflector/DBIC.pm9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
index 232a145..2d4e1a3 100644
--- a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
+++ b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
@@ -279,6 +279,11 @@ class DBIC, which {
};
};
+ implements _class_to_attribute_name => as {
+ my ( $self, $str ) = @_;
+ confess("wrong arguments passed for _class_to_attribute_name") unless $str;
+ return join('_', map lc, split(/::|(?<=[a-z0-9])(?=[A-Z])/, $str))
+ };
implements add_source => as {
my ($self, %opts) = @_;
@@ -301,7 +306,7 @@ class DBIC, which {
unless( $reader ){
$reader = $source;
$reader =~ s/([a-z0-9])([A-Z])/${1}_${2}/g ;
- $reader = join('_', map lc, split(/::/, $reader)) . "_collection"; #XXX change to not use _collection ?
+ $reader = $self->_class_to_attribute_name($reader) . "_collection";
}
unless( $dm_name ){
my @haystack = $meta->domain_models;
@@ -324,7 +329,7 @@ class DBIC, which {
required => 1,
isa => $collection,
reader => $reader,
- predicate => "has_" . join('_', map lc, split(/::|(?<=[a-z0-9])(?=[A-Z])/, $name)),
+ predicate => "has_" . $self->_class_to_attribute_name($name) ,
domain_model => $dm_name,
orig_attr_name => $source,
default => sub {