aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
diff options
context:
space:
mode:
authorgroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-16 06:06:18 +0000
committergroditi <groditi@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7>2008-02-16 06:06:18 +0000
commit7517cfe59c66f16fa08ce171b997f6bd7ff32ba5 (patch)
treeedf30941441966d90f4f16653f9396b0b79d3c2a /lib/Reaction/InterfaceModel/Reflector/DBIC.pm
parent56c5a4a1e847761faf792d9f1b3aebc17a85744d (diff)
downloadreaction-7517cfe59c66f16fa08ce171b997f6bd7ff32ba5.tar.gz
reaction-7517cfe59c66f16fa08ce171b997f6bd7ff32ba5.zip
90% there with Reflector code generation!
Diffstat (limited to 'lib/Reaction/InterfaceModel/Reflector/DBIC.pm')
-rw-r--r--lib/Reaction/InterfaceModel/Reflector/DBIC.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
index f0d5a65..3643bd1 100644
--- a/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
+++ b/lib/Reaction/InterfaceModel/Reflector/DBIC.pm
@@ -340,6 +340,26 @@ class DBIC, which {
},
);
+# my %debug_attr_opts =
+# (
+# lazy => 1,
+# required => 1,
+# isa => $collection,
+# reader => $reader,
+# predicate => "has_" . $self->_class_to_attribute_name($name) ,
+# domain_model => $dm_name,
+# orig_attr_name => $source,
+# default => qq^sub {
+# my \$self = \$_[0];
+# return $collection->new(
+# _source_resultset => \$self->$dm_name->resultset("$source"),
+# _parent => \$self,
+# );
+# }, ^,
+# );
+
+
+
my $make_immutable = $meta->is_immutable;
$meta->make_mutable if $make_immutable;
my $attr = $meta->add_attribute($name, %attr_opts);
@@ -666,6 +686,8 @@ class DBIC, which {
$from_attr->type_constraint->name eq 'ArrayRef' ||
$from_attr->type_constraint->is_subtype_of('ArrayRef');
+
+
if( my $rel_info = $source->relationship_info($attr_name) ){
my $rel_accessor = $rel_info->{attrs}->{accessor};
my $rel_moniker = $rel_info->{class}->result_source_instance->source_name;
@@ -707,6 +729,14 @@ class DBIC, which {
my $rs = shift->$dm_name->related_resultset($link_table)->related_resultset($mm_name);
return $attr_opts{isa}->new(_source_resultset => $rs);
};
+ #} elsif( $constraint_is_ArrayRef ){
+ #test these to see if rel is m2m
+ #my $meth = $attr_name;
+ #if( $source->can("set_${meth}") && $source->can("add_to_${meth}") &&
+ # $source->can("${meth}_rs") && $source->can("remove_from_${meth}") ){
+
+
+ #}
} else {
#no rel
my $reader = $from_attr->get_read_method;
@@ -803,6 +833,8 @@ class DBIC, which {
$source_class ||= $o_meta->find_attribute_by_name($dm_name)->_isa_metadata;
my $from_attr = $source_class->meta->find_attribute_by_name($attr_name);
+ #print STDERR "$attr_name is type: " . $from_attr->meta->name . "\n";
+
confess("${attr_name} is not writeable and can not be reflected")
unless $from_attr->get_write_method;