[Catalyst] Re: Adding relationships to loaded CDBI models
    Perrin Harkins 
    perrin at elem.com
       
    Tue Jun 21 18:31:57 CEST 2005
    
    
  
On Tue, 2005-06-21 at 11:14 -0500, samwyse wrote:
> '(0..1)' and '(0..n)' are trickier.  If object A (employee) has a
> reference to object B (spouse), and that reference can be NULL, then
> each person "might have" a spouse.
But Class::DBI handles that as "has_a", which supports NULLs just fine.
A "might_have" is a has_many (i.e. the spouse table has a foreign key
back to the employee table) with no more than 1.
The might_have thing is so confusing and so rarely useful that I doubt
it's worth putting in.  It was created as a sort of workaround to avoid
having lots of NULL columns by moving them off into a separate table
that points back to the main one.
- Perrin
    
    
More information about the Catalyst
mailing list