1

Possible Duplicate:
Foreign Key not storing in Yii

I have a database like this

====Group=====
id
name

====Member====
id
group_id
firstname
lastname
membersince

Now I used this relations in models.

Group Model

 public function relations()
  {
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
      'member' => array(self::HAS_MANY, 'Member', 'group_id'),
    );
  }

Member Model

 public function relations()
  {
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
      'group' => array(self::BELONGS_TO, 'Group', 'group_id'),
    );
  }

So can some one tell me is this relation is right or am I missing something any help and suggestios will be highly appreciable.

Community
  • 1
  • 1
Jagdish
  • 259
  • 1
  • 8
  • 19
  • The relation should be ok. Which sort of issue are you experiencing? – Fabrizio D'Ammassa Jan 23 '12 at 07:48
  • Looks correct to me. What problem do you have? – Joni Jan 23 '12 at 07:50
  • Regarding what issue I am facing is asked in this link http://stackoverflow.com/questions/8967895/foreign-key-not-storing-in-yii. I had a doubt that might be there some problem in relations so I asked that. Can you please check that link if you want to help me ut. – Jagdish Jan 23 '12 at 08:12

0 Answers0