Class Yiisoft\ActiveRecord\Event\Handler\SetValueOnUpdate
| Inheritance | Yiisoft\ActiveRecord\Event\Handler\SetValueOnUpdate » Yiisoft\ActiveRecord\Event\Handler\AttributeHandlerProvider |
|---|---|
| Subclasses | Yiisoft\ActiveRecord\Event\Handler\SetDateTimeOnUpdate |
Attribute for setting value for properties before updating an existing record in the database.
It can be applied to classes or properties, and it can be repeated for multiple properties.
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ActiveRecord\Event\Handler\SetValueOnUpdate | |
| getEventHandlers() | Yiisoft\ActiveRecord\Event\Handler\SetValueOnUpdate | |
| getPropertyNames() | Returns the list of property names the handler should be applied to. | Yiisoft\ActiveRecord\Event\Handler\AttributeHandlerProvider |
| setPropertyNames() | Sets the list of property names the handler should be applied to. | Yiisoft\ActiveRecord\Event\Handler\AttributeHandlerProvider |
Method Details
| public __construct( mixed $value = null, string $propertyNames ): mixed | ||
| $value | mixed | |
| $propertyNames | string | |
public function __construct(
private mixed $value = null,
string ...$propertyNames,
) {
parent::__construct(...$propertyNames);
}
| public getEventHandlers( ): array |
public function getEventHandlers(): array
{
return [
BeforeUpdate::class => $this->beforeUpdate(...),
BeforeUpsert::class => $this->beforeUpsert(...),
];
}
Defined in: Yiisoft\ActiveRecord\Event\Handler\AttributeHandlerProvider::getPropertyNames()
Returns the list of property names the handler should be applied to.
| public getPropertyNames( ): string[] |
public function getPropertyNames(): array
{
return $this->propertyNames;
}
Defined in: Yiisoft\ActiveRecord\Event\Handler\AttributeHandlerProvider::setPropertyNames()
Sets the list of property names the handler should be applied to.
| public setPropertyNames( string[] $propertyNames ): void | ||
| $propertyNames | string[] | |
public function setPropertyNames(array $propertyNames): void
{
$this->propertyNames = $propertyNames;
}
Signup or Login in order to comment.