CDBI::Relationship::IsA bug

[prev] [thread] [next] [Date index for 2005/04/07]

From: Peter Speltz
Subject: CDBI::Relationship::IsA bug
Date: 23:49 on 07 Apr 2005
Just spent two hours trying to figure out what the heck i did to break
something i wasn't even working on.  Classes with an is_a relationship weren't
getting the related column set to the base classes id all of a sudden.  The
base class row was inserted but relationship wasn't made.  

I'm usually the culprit but this time i think it is IsA.pm. 
In IsA::_creator  the related column is set to the *object* rather than the
object's *id*.  

Here's the patch (sorry no failing test case) :

diff -u IsA.orig.pm IsA.pm
--- IsA.orig.pm 2005-04-06 18:46:38.990073984 -0500
+++ IsA.pm      2005-04-06 18:47:06.766851272 -0500
@@ -257,7 +257,7 @@
        my $f_obj = $f_class->create($hash);
        $proto->_import_column_values($self, $f_class, $f_obj);

-       return $self->_attribute_store($col => $f_obj);
+       return $self->_attribute_store($col => $f_obj->id);
     };
 }


Finally i figured out that some hours back i had made a stringify self method
for my is_a base class that didn't return id as first part of string (my system
with mysql was happy with '1 ASDFFA asdfaf' but not '(1) ASDFAF asdfaf' ).

Anyway ... 




pjs


		
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com

CDBI::Relationship::IsA bug
Peter Speltz 23:49 on 07 Apr 2005

Generated at 14:42 on 11 Apr 2005 by mariachi v0.52