Yii Framework Forum: Problem With Relation - Yii Framework Forum

Jump to content

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

Problem With Relation Rate Topic: -----

#1 User is offline   adri00713 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 28-January 13

Posted 11 February 2013 - 03:08 PM

i have two models BaseReceivedItem and BaseRefSiDetails

BaseReceivedItem model relation

public function relations(){	
	return array(
		'details' => array(self::BELONGS_TO, 'BaseRefSiDetails', 'details_id'),
		);
	}



BaseRefSiDetails model relation

public function relations(){	
	return array(
		'siReceivedItems' => array(self::HAS_MANY, 'BaseSiReceivedItem', 'details_id'),
		);
	}


i need to display datas from baseresidetails into the grid of basereceiveditem

i use this

$data->details->stockno;


but no results found please help .
0

#2 User is offline   seenivasan 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 620
  • Joined: 17-June 12
  • Location:Chennai,TamilNadu,India.

Posted 11 February 2013 - 03:24 PM

Dear Friend

It should be like this.
'columns'=>array(
		'id',

		'details.stockno',
......................................
.........................................
                  
)


or

it should be
'columns'=>array(
		'id',

               array(
                 'name'=>'someName',
                  'value'=>'$data->details->stockno',
                   ),
......................................
.........................................
                  
)


Regards.
0

#3 User is offline   adri00713 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 28-January 13

Posted 11 February 2013 - 03:40 PM

i tried it before but same no results maybe theres problem on my relations ..
0

#4 User is offline   le_top 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 369
  • Joined: 08-June 10
  • Location:France (Ile-de-France/Val d'Oise)

Posted 11 February 2013 - 05:57 PM

Hi
Check out the SQL query that is built. Either by logging to a file or using the Yii Debug Toolbar Extension .
Verify what is going on by testing the query in phpmyadmin for instance and adjust the query until you get results (probably removing some of the conditions). Determine how that should impact your models.
0

#5 User is offline   adri00713 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 28-January 13

Posted 11 February 2013 - 10:33 PM

how can i test the query ??
0

#6 User is offline   mirunho 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 170
  • Joined: 19-December 12
  • Location:Gdansk, Poland

Posted 12 February 2013 - 02:02 AM

View Postadri00713, on 11 February 2013 - 10:33 PM, said:

how can i test the query ??


le_top described it...

View Postle_top, on 11 February 2013 - 05:57 PM, said:

Hi
Check out the SQL query that is built. Either by logging to a file or using the Yii Debug Toolbar Extension .
Verify what is going on by testing the query in phpmyadmin for instance and adjust the query until you get results (probably removing some of the conditions). Determine how that should impact your models.

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