[CDBI] has_many - how to specify link columns ?

Michael Reece mreece at vinq.com
Tue Aug 15 21:16:27 BST 2006


'should not' is a dangerous assumption!  i have found that, since i  
cannot always guarantee the order that the classes are 'used', that i  
get intermittent failures[*] if i rely on the assumptions.  so i've  
developed the habit of _always_ defining the third argument, just to  
be sure me and HasMany agree on what is expected.

[*] - where 'failure' is defined as HasMany assuming the table  
'moniker' as they key, typically due to circular 'use' cases where  
CDBI::One might need to use CDBI::Two and vice versa so i can make  
use of these classes in other methods (not list defining  
relationships).  so CDBI::One may not have set up its has_a before  
CDBI::Two tries to has_many.

On Aug 15, 2006, at 12:47 PM, Ryan Tate wrote:

> On 8/15/06, Michael Reece <mreece at vinq.com> wrote:
>>   articles->has_many( prices => 'prive2articles' => 'artid' );  #  
>> third
>> argument is 'my key in foreign table'
>
> The third argument to has_many should not be needed, assuming
> price2articles class properly sets up has_a relationship with articles
> class, i.e.:
>
> $price2articles_class->has_a( artid => $article_class );
> $article_class->has_many( prices => $price2articles_class );
>
> By the way, why not just rename the "price2articles" table "prices?"
> Seems a lot simpler.
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

---
michael reece :: software engineer :: mreece at vinq.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digitalcraftsmen.net/pipermail/classdbi/attachments/20060815/4fe22190/attachment-0001.html


More information about the ClassDBI mailing list