PHP Trait Esensi\Model\Traits\PurgingModelTrait

See also: Esensi\Model\Contracts\PurgingModelInterface
Author: Daniel LaBarge ([email protected])
显示文件 Open project: esensi/model

Protected Properties

Property Type Description
$purging boolean Whether the model is purging or not.

Public Methods

Method Description
addPurgeable ( string $attribute ) Add an attribute to the purgeable array.
bootPurgingModelTrait ( ) Boot the trait's observers.
getPurgeable ( ) : array Get the purgeable attributes.
getPurging ( ) : boolean Returns whether or not the model will purge attributes before saving.
isPurgeable ( string $attribute ) : boolean Returns whether the attribute is purgeable.
mergePurgeable ( array $attributes ) Merge an array of attributes with the purgeable array.
purgeAttributes ( ) Unset attributes that should be purged.
removePurgeable ( string $attribute ) Remove an attribute from the purgeable array.
saveWithPurging ( ) : boolean Save with purging even if purging is disabled.
saveWithoutPurging ( ) : boolean Save without purging even if purging is enabled.
setPurgeable ( array $attributes ) Set the purgeable attributes.
setPurging ( $value ) Set whether or not the model will purge attributes before saving.

Protected Methods

Method Description
setPurgingAndSave ( boolean $purge ) : boolean Set purging state and then save and then reset it.

Method Details

addPurgeable() public method

Add an attribute to the purgeable array.
public addPurgeable ( string $attribute )
$attribute string to purge

bootPurgingModelTrait() public static method

Boot the trait's observers.
public static bootPurgingModelTrait ( )

getPurgeable() public method

Get the purgeable attributes.
public getPurgeable ( ) : array
return array

getPurging() public method

Returns whether or not the model will purge attributes before saving.
public getPurging ( ) : boolean
return boolean

isPurgeable() public method

Returns whether the attribute is purgeable.
public isPurgeable ( string $attribute ) : boolean
$attribute string name
return boolean

mergePurgeable() public method

Merge an array of attributes with the purgeable array.
public mergePurgeable ( array $attributes )
$attributes array to purge

purgeAttributes() public method

Unset attributes that should be purged.
public purgeAttributes ( )

removePurgeable() public method

Remove an attribute from the purgeable array.
public removePurgeable ( string $attribute )
$attribute string to purge

saveWithPurging() public method

Save with purging even if purging is disabled.
public saveWithPurging ( ) : boolean
return boolean

saveWithoutPurging() public method

Save without purging even if purging is enabled.
public saveWithoutPurging ( ) : boolean
return boolean

setPurgeable() public method

Set the purgeable attributes.
public setPurgeable ( array $attributes )
$attributes array to purge

setPurging() public method

Set whether or not the model will purge attributes before saving.
public setPurging ( $value )

setPurgingAndSave() protected method

Set purging state and then save and then reset it.
protected setPurgingAndSave ( boolean $purge ) : boolean
$purge boolean
return boolean

Property Details

$purging protected_oe property

Whether the model is purging or not.
protected bool $purging
return boolean