Re: [CDBI] Redefine has_many relationship
[prev]
[thread]
[next]
[Date index for 2005/09/18]
On Sat, Sep 17, 2005 at 10:01:01PM -0400, Christopher H. Laco wrote:
> Matt S Trout wrote:
> >On Sat, Sep 17, 2005 at 03:34:43PM -0400, Christopher H. Laco wrote:
> >
> >>What's the solution to this?
> >
> >
> >1) E-mail Tony Bowden and hope he's in a good mood
> >2) Switch to DBIx::Class which doesn't suffer from this fuckup in the first
> > place.
> >
>
> I'll take this with a few grains of salt because I know you. :-)
>
> With that said, if you're going to troll the CDBI list, try and do a
> little more than "fsck0Rs CDBI, use DBIC". :-)
That isn't a troll; Class::DBI's refusal to override things in subclasses
is IMO a complete pain, and something that's shot me in the foot many a
time. Admittedly, DBIC's implementation lets you shoot you in the head if you
want to, but at least it does what it's told :)
> Now, for the solution [for me]:
>
> > undef(*_items);
> > undef(*add_to__items);
> > __PACKAGE__->has_many(_items => $item_class, 'cart');
>
>
> That's is the original cart class. Apparently I was trying too hard with
> encantations of *CustomCart::_items and $__PACKAGE__::_items...
Kinda cute, although I worry you're not undef'ing the methods in the package
you think you are - if it's superclass methods it's worrying about overriding
then surely that won't clear them. Are you adding methods to the class you
think you're adding them to?
--
Matt S Trout Specialists in perl consulting, web development, and
Technical Director UNIX/Linux systems architecture and automation. Mail
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi