[CDBI] Redefine has_many relationship

Christopher H. Laco claco at chrislaco.com
Sat Sep 17 20:34:43 BST 2005


What's the easiest way to redefine a has_many relationship?

I have Cart/Item classes. Cart is setup with:

   __PACKAGE__->has_many(_items => 'Cart::Item', 'cart');



Now, if someone subclasses Cart, they also presumable want to subclass 
Cart::Item as well. This, however, doesn't work:


   package CustomCart::CustomItem;
   use base 'Cart::Item';
   1;


   package CustomCart;
   use base 'Cart';

   __PACKAGE__->has_many(_items => 'CustomCart::CustomItem', 'cart');

   1;


That yields:

   _items method already exists in CustomCart. I've tried all sorts of 
symbol table hackery, but nothing works thus far.

What's the solution to this?

Thanks,
-=Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3178 bytes
Desc: S/MIME Cryptographic Signature
Url : http://lists.digitalcraftsmen.net/mailman/private/classdbi/attachments/20050917/37db9dd9/smime.bin


More information about the ClassDBI mailing list