Yii Framework Forum: Chain of filter lists - Yii Framework Forum

Jump to content

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

Chain of filter lists Rate Topic: -----

#1 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 29 November 2008 - 11:36 PM

It seems like a filter list in my parent class is masked by a filter list in my inherited class. Inherited filter functions is called if I add the specification in the inherited class.

/Tommy

0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 30 November 2008 - 07:32 AM

If you override filters() in both parent and child classes, you need to make sure you merge the parent filters into the child's.
0

#3 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 30 November 2008 - 11:05 AM

Thanks,
I think it might be a good idea to mention this in the documention.

public function filters()
{
  return array_merge (
    array (
      '...'
      ),
    parent::filters()
    );
}


/Tommy

0

#4 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,899
  • Joined: 04-October 08
  • Location:DC, USA

Posted 30 November 2008 - 01:56 PM

Thanks for the suggestion. Just updated the API doc.
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