Yii Framework Forum: CActiveDataProvider and parameterised named scopes - Yii Framework Forum

Jump to content

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

CActiveDataProvider and parameterised named scopes Rate Topic: -----

#1 User is offline   amc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 13-March 09

Posted 27 March 2010 - 02:45 PM

I have a parameterised named scope which I use to provide searching on a datamodel e.g.

$data = MyModel:model()->searchFor($q)->findAll(..);


Is there a way to specify parameterised named scopes when using a CActiveDataProvider?

Thanks

amc
0

#2 User is offline   Nagash 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 15
  • Joined: 10-September 09

Posted 27 March 2010 - 04:26 PM

Maybe, this is what you're looking for?
http://www.yiiframew...er-with-scopes/
0

#3 User is offline   amc 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 46
  • Joined: 13-March 09

Posted 28 March 2010 - 01:14 PM

Thanks Nagash

This extension seems to support normal scopes but not parameterised scopes.

amc
0

#4 User is offline   acorncom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 99
  • Joined: 25-February 11
  • Location:CO, USA

Posted 18 July 2012 - 05:22 PM

I know this is a couple of years past when you asked the question, but for people looking at this thread in the future, check out this thread: http://www.yiiframew...-using-yii-118/

I ended up figuring it out. Yii 1.1.7 allows you to call a scoping function with parameters. Quite cool.
0

#5 User is offline   Gerhard Liebenberg 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 333
  • Joined: 07-January 12
  • Location:Stillbay - Western Cape - South Africa

Posted 20 January 2013 - 03:00 PM

Here is an example of using a parameterized named scope in both the find() functions and in dataprovider generation:

Parameterized named scope
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