conflicting advice about has_a and primary keys

[prev] [thread] [next] [Date index for 2004/05/18]

From: Perrin Harkins
Subject: conflicting advice about has_a and primary keys
Date: 18:04 on 18 May 2004
The CDBI docs contain this piece of advice in the has_a() section:

"*NOTE* You should not attempt to make your primary key column inflate
using has_a() as bad things will happen. If you have two tables which
share a primary key, consider using might_have() instead."

A little further down in the many-to-many section, it breaks this rule.

"First of all we'll set up our Role class:

        Role->table('role');
        Role->columns(Primary => qw/film actor/);
        Role->has_a(film => 'Film');
        Role->has_a(actor => 'Actor');

We have a multi-column primary key, with each column pointing to another
class."

Which of these is correct?  Or is it just that using has_a() on your
primary key fails if you specify an inflate() method?

- Perrin


conflicting advice about has_a and primary keys
Perrin Harkins 18:04 on 18 May 2004

Re: conflicting advice about has_a and primary keys
Vince Veselosky 18:58 on 18 May 2004

Re: conflicting advice about has_a and primary keys
Charles Bailey 20:20 on 18 May 2004

Generated at 11:35 on 01 Dec 2004 by mariachi v0.52