Yii Framework Forum: Inserting Related Records - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Inserting Related Records Rate Topic: -----

#1 User is offline   redam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 14-November 13

Posted 15 November 2013 - 10:45 AM

hello there , this is my first post so please be lenient.
atached if the eer diagram,
in the client form i am adding a dropddown of different roles.


how can i insert the client in the client table and the association in the client_has_role table .


thank you.

Attached File(s)

  • Attached File  a.png (7.22K)
    Number of downloads: 8

0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 2,082
  • Joined: 16-February 11
  • Location:Japan

Posted 16 November 2013 - 06:42 AM

Hi redam, welcome to the forum.

So this is a typical MANY_MANY relation.
Usually we create and save the client model first and get the id of the client. And then we save the client_has_role model, specifying the id of the client and the id of the role.

Yii doesn't support the automated saving of the related objects out of the box, so you have to do it by yourself.
You may want to use some extension to automate the process.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users