Yii Framework Forum: How to add relation between curd and custom table - Yii Framework Forum

Jump to content

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

How to add relation between curd and custom table

#1 User is offline   vinaya 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-May 17

Posted 02 May 2017 - 07:07 AM

I have created a curd using curd generation (with table status) in yii2-advanced application. and curd(create,view,edit,delete) is working properly.

Now I have created a new table relation (id, user_id, status_id) where user_id is the foreign key for user table and status_id is also foreign key for status table.

Now I want to update table relation on update status from backend.

For example :
1) If one user (user_id is 1) creates new status then there will be a new entry in relation table like "relation (1, 1, {status_id just created by user})".
2) if user delete status then the row with this status_id will also be removed from relation table.
3) And these created status only visible to user_id 1 only not to other users (one user can only see his created status not to others).

I am new to this framework, so please guide me how to implement this scenario in my application?

Thanks in advance.
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