Re: Cross between MightHave and HasMany?

[prev] [thread] [next] [Date index for 2004/11/02]

From: Kingsley Kerce
Subject: Re: Cross between MightHave and HasMany?
Date: 22:39 on 02 Nov 2004
Peter Speltz writes:
 > Since a person has at most only one category, Why do you not want to store
 > category_id  in person?  

Jess -- Peter's response is right on.  Why can't you use has_a?

create table person (
    personid int primary key auto_increment,
    category int,
    firstname varchar(32),
    initials varchar(16),
    surname varchar(64),
    date_of_birth datetime
  );

create table categories (
    catid int primary key auto_increment,
    category varchar(128)
  );

Person->has_a(category => 'Categories');

Jess originally wrote:
 > Essentially I'd like  
 > $person->category() and $person->category($catobj) to do the right thing.

$person->category() does what you want.

$person->category($catobj->id) DWYW.

Jess originally wrote:
 > Also I'd like to be able to remove the relationship, without deleting  
 > either the person or the category themselves.

$person->category(undef) does that.

Kings

(message missing)

Cross between MightHave and HasMany?
Jess Robinson 19:47 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Kingsley Kerce 20:08 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Jess Robinson 21:20 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Kingsley Kerce 21:35 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Jess Robinson 22:09 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Tony Bowden 23:43 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Peter Speltz 22:06 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Kingsley Kerce 22:39 on 02 Nov 2004

Re: Cross between MightHave and HasMany?
Jess Robinson 06:35 on 03 Nov 2004

Re: Cross between MightHave and HasMany?
William McKee 14:21 on 05 Nov 2004

Re: Cross between MightHave and HasMany?
Peter Speltz 14:36 on 05 Nov 2004

Re: Cross between MightHave and HasMany?
Jess Robinson 20:06 on 05 Nov 2004

Re: Cross between MightHave and HasMany?
William McKee 03:34 on 06 Nov 2004

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