Yii Framework Forum: Using Sql View In Relation - Yii Framework Forum

Jump to content

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

Using Sql View In Relation Rate Topic: ***** 1 Votes

#1 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 08-February 12
  • Location:islamabad

Posted 24 April 2013 - 12:03 AM

I am using SQL view (which is supporting primary key), I have created Model. But making a relationship with other. So how can i create a Relation (one-many) with out Primary?
thanks
0

#2 User is online   Fabrizio Caldarelli 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 479
  • Joined: 21-March 13
  • Location:Rome, Italy

Posted 24 April 2013 - 02:14 AM

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

#3 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 08-February 12
  • Location:islamabad

Posted 25 April 2013 - 01:20 AM

thanks Fabrizio Caldarelli
I solve my problem using On

'vmFilterData' => array(self::HAS_MANY, 'Vmfilters', '', 'on'=>'vmFilterData.VMID = t.id'),

and define primary in Vmfilters

public function primaryKey()
{
return 'id';
}

thank you sooooooooo much for quick response!!!!!!!!!
0

#4 User is offline   sefburhan 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 137
  • Joined: 08-February 12
  • Location:islamabad

Posted 28 May 2013 - 04:36 AM

View Postfburhan89, on 25 April 2013 - 01:20 AM, said:

thanks Fabrizio Caldarelli
I solve my problem using On

'vmFilterData' => array(self::HAS_MANY, 'Vmfilters', '', 'on'=>'vmFilterData.VMID = t.id'),

and define primary in Vmfilters

public function primaryKey()
{
return 'id';
}

thank you sooooooooo much for quick response!!!!!!!!!


BUT still this is NOT working when using many relationships i.e with other tables Please any solution?
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