Yii Framework Forum: Join Table - Yii Framework Forum

Jump to content

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

Join Table Rate Topic: -----

#1 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 29 April 2013 - 10:36 AM

hello guys... I need to know how to get data within one to many relationsip using yii.
for ex when we have the table client and policy(one to many)how do I get the data in client table using this relationship.thank you.pls help me.If you know good tutorials for that pls give me thoose urls.thank you
0

#2 User is offline   Fabrizio Caldarelli 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 282
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 29 April 2013 - 10:41 AM

http://www.yiiframew...en/database.arr
0

#3 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 29 April 2013 - 11:06 AM

/* moved from Extensions forum */
"Less noise - more signal"
0

#4 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 29 April 2013 - 01:42 PM

View PostFabrizio Caldarelli, on 29 April 2013 - 10:41 AM, said:


Thanks.I already studiedit.Can you tell me any other tutorials??
0

#5 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 29 April 2013 - 08:11 PM

View Postsldra, on 29 April 2013 - 01:42 PM, said:

Thanks.I already studiedit.Can you tell me any other tutorials??

hello pls give me one tutorials for the above topic with deceleration with the behavior of model view and controller in yii. pls give me sample coding related to that question.thanks lot..it is great help to me
0

#6 User is offline   Shahcheraghean 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 478
  • Joined: 12-December 12
  • Location:Mashhad, IRAN

Posted 30 April 2013 - 02:10 AM

For example, a post have many comments:
in the post model:
function relation(){
...
    	'comments' =>array(self::HAS_MANY, 'Comment', 'post_id'),
...
}


in the view:
foreach($data->comments as $val){
   echo $val->title;
}

www.shgn.ir
www.shgn.ir/yii-framework/
yii2.swsco.ir
In a world without any fences or walls,Who needs Gates or Windows!
0

#7 User is offline   sldra 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 123
  • Joined: 11-October 12

Posted 01 May 2013 - 06:35 AM

View PostShahcheraghean, on 30 April 2013 - 02:10 AM, said:

For example, a post have many comments:
in the post model:
function relation(){
...
    	'comments' =>array(self::HAS_MANY, 'Comment', 'post_id'),
...
}


in the view:
foreach($data->comments as $val){
   echo $val->title;
}





Thanks lot :)
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