Yii Framework Forum: Attaching Event Handler Inside Model - Yii Framework Forum

Jump to content

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

Attaching Event Handler Inside Model Rate Topic: -----

#1 User is offline   msoa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 258
  • Joined: 15-August 12

Posted 18 January 2014 - 05:49 AM

By following way can not attach static event handler inside itself model:
class model extends CActiveRecord
{

	$this->onTest=array($this,'staticHandler');

	public static function staticHandler()	{
		print "This is static handler.\n";
	}	

	public function onTest($event)	{
	   $this->raiseEvent('onTest',$event);
	}
}

Is possible attaching an event handler inside model?how to?
0

#2 User is offline   msoa 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 258
  • Joined: 15-August 12

Posted 19 January 2014 - 03:03 PM

How you attach event handler inside the model?
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