PHP Class WhEditableSaver

Helps to update model by editable widget submit request.
Author: Antonio Ramirez ([email protected])
Author: Vitaliy Potapov ([email protected])
Inheritance: extends CComponent
Mostra file Open project: 2amigos/yiiwheels

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 scenario used in model for update. Can be taken from scenario POST param
$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 ) : EditableBackend Constructor
checkErrors ( ) errors as CHttpException
error ( $msg ) errors as CHttpException
onAfterUpdate ( CEvent $event ) This event is raised after the update is performed.
onBeforeUpdate ( CModelEvent $event ) This event is raised before the update is performed.
setAttribute ( mixed $name, mixed $value ) setting new value of attribute.
update ( ) main function called to update column in database

Protected Methods

Method Description
afterUpdate ( ) afterUpdate
beforeUpdate ( ) beforeUpdate

Method Details

__construct() public method

Constructor
public __construct ( $modelClass ) : EditableBackend
return EditableBackend

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

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_oe property

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

$changedAttributes protected_oe property

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

$errorHttpCode public_oe property

http status code returned in case of error
public $errorHttpCode

$model public_oe property

model instance
public CActiveRecord $model
return CActiveRecord

$modelClass public_oe property

name of model
public mixed $modelClass
return mixed

$primaryKey public_oe property

primaryKey value
public mixed $primaryKey
return mixed

$scenario public_oe property

scenario used in model for update. Can be taken from scenario POST param
public mixed $scenario
return mixed

$value public_oe property

new value of attribute
public $value