Yii Framework Forum: Event "CActiveDataProvider.onAfterConstruct" is not defined. - Yii Framework Forum

Jump to content

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

Event "CActiveDataProvider.onAfterConstruct" is not defined. can we attach a behavior to CActiveDataProvider? Rate Topic: -----

#1 User is offline   Pentium10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 174
  • Joined: 10-December 10

Posted 01 February 2011 - 03:36 PM

I am trying to attach a behavior to CActiveDataProvider


$b=new CActiveDataProvider(get_class($this), array(
	'criteria'=>$criteria,
));
$b->attachBehavior('1',array(
        'class' => 'application.components.MyBehavior',
));


I get


CException
Event "CActiveDataProvider.onAfterConstruct" is not defined.

\framework\base\CComponent.php(485)

What I am doing wrong?
0

#2 User is offline   Pentium10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 174
  • Joined: 10-December 10

Posted 06 March 2011 - 07:56 AM

Anyone on this?
0

#3 User is offline   tri 

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

Posted 06 March 2011 - 12:36 PM

View PostPentium10, on 06 March 2011 - 07:56 AM, said:

Anyone on this?


The onAfterConstruct event is defined in CModel. CActiveDataProvider doesn't inherit from CModel.

/Tommy
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

#4 User is offline   Pentium10 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 174
  • Joined: 10-December 10

Posted 06 March 2011 - 12:55 PM

How to create behaviors for CActiveDataProvider ?
0

#5 User is offline   sensorario 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,987
  • Joined: 07-September 10
  • Location:Cesena (Italy)

Posted 16 May 2011 - 08:16 AM

I get now the same problem. =( I do not know what happened. I've just added a behavior that work well in others sites.
0

#6 User is offline   sonam 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 10-September 11

Posted 20 September 2011 - 10:43 AM

same problem with me also
0

#7 User is offline   sonam 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 79
  • Joined: 10-September 11

Posted 20 September 2011 - 10:53 AM

same problem with me also
0

#8 User is offline   chriscao 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 43
  • Joined: 03-February 10

Posted 19 January 2012 - 07:58 AM

:rolleyes:
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