Blameable
Zemit\Mvc\Model\Traits\Behavior\Blameable
Allows to automatically update a model’s attribute saving the datetime when a record is created or updated
- Full name: \Zemit\Mvc\Model\Behavior\Blameable
- Parent class: Behavior
Properties
parentId
protected static ?int $parentId
- This property is static.
snapshot
protected ?array $snapshot
changedFields
protected ?array $changedFields
auditClass
protected string $auditClass
auditDetailClass
protected string $auditDetailClass
userClass
protected string $userClass
Methods
__construct
public __construct(array $options = []): mixed
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $options | array | 
notify
public notify(string $type, \Phalcon\Mvc\ModelInterface $model): ?bool
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $type | string | |
| $model | \Phalcon\Mvc\ModelInterface | 
Throws:
createAudit
Create new audit Return true if the audit was created
public createAudit(string $type, \Zemit\Mvc\Model $model): bool
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $type | string | |
| $model | \Zemit\Mvc\Model | 
Throws:
collectData
Return true if data has been collected
protected collectData(\Zemit\Mvc\Model $model): bool
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $model | \Zemit\Mvc\Model | 
Inherited methods
getEnabled
Return true if the behavior is enabled on the current model instance
public getEnabled(): bool
setEnabled
Set true to enable the behavior on the current model instance
public setEnabled(bool $enabled): void
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $enabled | bool | 
getStaticEnabled
Return true if the behavior is enabled globally for every model instance
public static getStaticEnabled(): bool
- This method is static.
setStaticEnabled
Set true to enable the behavior globally for every model instance
public static setStaticEnabled(bool $staticEnabled): void
- This method is static.
Parameters:
| Parameter | Type | Description | 
|---|---|---|
| $staticEnabled | bool | 
enable
Enable the behavior on the current model instance
public enable(): void
disable
Disable the behavior on the current model instance
public disable(): void
staticEnable
Enable the behavior globally for every model instance
public static staticEnable(): void
- This method is static.
staticDisable
Disable the behavior globally for every model instance
public static staticDisable(): void
- This method is static.
isEnabled
Return true if the behavior is enabled on the current model instance and globally
public isEnabled(): bool
isDisabled
Return true if the behavior is enabled on the current model instance and globally
public isDisabled(): bool