Yii Framework Forum: How make relation - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

How make relation How make relation Rate Topic: -----

#1 User is offline   Balu 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 152
  • Joined: 09-August 11
  • Location:Kerala, India

Posted 21 February 2012 - 02:41 AM

I have two tables Courses and Batches
Courses fields are

id(PK)
course_name
code
section_name
is_deleted
created_at
updated_at

Batches Field are
id(PK)
name
course_id(FK)
start_date
end_date
is_active
is_deleted
employee_id

How I can make relations in both the models
Can any one help me...
0

#2 User is offline   StasuSS 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 20-February 12
  • Location:Kaluga, Russia

Posted 21 February 2012 - 02:55 AM

if you are talking about AR models, this will help you.
Things are very seldom what they seem. In my experience, they’re usually a damn sight worse. (Inquisitor Titus Drake)
0

#3 User is offline   kokomo 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 281
  • Joined: 23-July 10

Posted 21 February 2012 - 02:59 AM

Hi,
you learn much more if you try to do it yourself cause it is a really easy task.

The Working with Databases: Relational Active Record topic in the guide should help you out.
Look at the relation between tbl_user and tbl_post tables, it's like in your example.

If you don't be able to do it ask again and I or somebody else will help you but first try it yourself Posted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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