Yii Framework Forum: how to ignore defaultScope in CActiveRecord - Yii Framework Forum

Jump to content

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

how to ignore defaultScope in CActiveRecord Using defaultScope Rate Topic: -----

#1 User is offline   ignis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-April 10
  • Location:Lithuania - Vilnius

Posted 21 October 2010 - 02:46 AM

Hello,

I'm thinking how to ignore default scopes

I'm using


    	$criteria = new CDbCriteria;

    	$criteria->order = 'fields.position DESC';

    	$criteria->together = true;

    	$criteria->condition = 'publish=:publish AND category_id IS NOT NULL';

    	$criteria->params = array(':publish' => 1);

    	$fields = ItAdsCategories::model()->with('fields');

    	

    	//$fields->resetScope();   // ????????

    	$fields = $fields->findAll($criteria);



I don't understand in witch plase I must use resetScopes to reset 'fields' relation default scopes.

Hope I clearlly describe my problem :)

thanks
0

#2 User is offline   fastcrash 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 245
  • Joined: 10-March 10
  • Location:South Jakarta

Posted 21 October 2010 - 03:09 AM

your welcome
Hey, are you indonesian..

Posted Image

i never use resetScope, sorry.
which yii class belongs to this function?
0

#3 User is offline   ignis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-April 10
  • Location:Lithuania - Vilnius

Posted 21 October 2010 - 03:29 AM

Go to http://www.yiiframew...com/doc/api/1.1 and insert resetScope

Are there any examples how to use reset scope with MyModel::model()->with('myrelation')->findAll ?
0

#4 User is offline   ignis 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-April 10
  • Location:Lithuania - Vilnius

Posted 21 October 2010 - 02:26 PM

AS i find out it will be fixed in 1.2 version.
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