PHP Class TbEditableSaver

Inheritance: extends CComponent
Show file Open project: yinhe/yincart Class Usage Examples

Public Properties

Property Type Description
$attribute mixed name of attribute to be updated
$errorHttpCode http status code returned in case of error
$model CActiveRecord model instance
$modelClass mixed name of model
$primaryKey mixed primaryKey value
$scenario mixed scenarion used in model for update
$value new value of attribute

Protected Properties

Property Type Description
$changedAttributes mixed name of changed attributes. Used when saving model

Public Methods

Method Description
__construct ( $modelClass ) : TbEditableSaver ### ._construct()
checkErrors ( ) ### .checkErros()
error ( $msg ) ### .error()
onAfterUpdate ( CEvent $event ) ### .onAfterUpdate()
onBeforeUpdate ( CModelEvent $event ) ### .onBeforeUpdate()
setAttribute ( mixed $name, mixed $value ) ### .setAttribute()
update ( ) ### .update()

Protected Methods

Method Description
afterUpdate ( ) ### .afterUpdate()
beforeUpdate ( ) ### .beforeUpdate()

Method Details

__construct() public method

Constructor
public __construct ( $modelClass ) : TbEditableSaver
$modelClass
return TbEditableSaver

afterUpdate() protected method

afterUpdate
protected afterUpdate ( )

beforeUpdate() protected method

beforeUpdate
protected beforeUpdate ( )

checkErrors() public method

errors as CHttpException
public checkErrors ( )

error() public method

errors as CHttpException
public error ( $msg )
$msg

onAfterUpdate() public method

This event is raised after the update is performed.
public onAfterUpdate ( CEvent $event )
$event CEvent the event parameter

onBeforeUpdate() public method

This event is raised before the update is performed.
public onBeforeUpdate ( CModelEvent $event )
$event CModelEvent the event parameter

setAttribute() public method

setting new value of attribute. Attrubute name also stored in array to save only changed attributes
public setAttribute ( mixed $name, mixed $value )
$name mixed
$value mixed

update() public method

main function called to update column in database
public update ( )

Property Details

$attribute public property

name of attribute to be updated
public mixed $attribute
return mixed

$changedAttributes protected property

name of changed attributes. Used when saving model
protected mixed $changedAttributes
return mixed

$errorHttpCode public property

http status code returned in case of error
public $errorHttpCode

$model public property

model instance
public CActiveRecord $model
return CActiveRecord

$modelClass public property

name of model
public mixed $modelClass
return mixed

$primaryKey public property

primaryKey value
public mixed $primaryKey
return mixed

$scenario public property

scenarion used in model for update
public mixed $scenario
return mixed

$value public property

new value of attribute
public $value