0 follower

Final Class Yiisoft\ActiveRecord\Event\BeforeUpdate

InheritanceYiisoft\ActiveRecord\Event\BeforeUpdate » Yiisoft\ActiveRecord\Event\AbstractEvent
ImplementsPsr\EventDispatcher\StoppableEventInterface

Event triggered before the record is updated in the database.

It allows modifying properties that will be used for {@see \Yiisoft\ActiveRecord\ActiveRecordInterface::update()} operation.

See also Yiisoft\ActiveRecord\ActiveRecordInterface::update().

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\ActiveRecord\Event\BeforeUpdate
getReturnValue() Returns the value that will be returned by the method that triggered this event if the {@see AbstractEvent::isDefaultPrevented() default action is prevented}. Yiisoft\ActiveRecord\Event\AbstractEvent
isDefaultPrevented() Checks if the default action associated with this event has been prevented. Yiisoft\ActiveRecord\Event\AbstractEvent
isPropagationStopped() Yiisoft\ActiveRecord\Event\AbstractEvent
preventDefault() Prevents the default action associated with this event from being executed. Yiisoft\ActiveRecord\Event\AbstractEvent
returnValue() Sets the return value which will be returned by the method that triggered this event if the {@see AbstractEvent::isDefaultPrevented() default action is prevented}. Yiisoft\ActiveRecord\Event\AbstractEvent
stopPropagation() Stops the propagation of the event to further listeners. Yiisoft\ActiveRecord\Event\AbstractEvent

Property Details

Hide inherited properties

$properties public property
public ?array $properties null

Method Details

Hide inherited methods

__construct() public method

public mixed __construct ( Yiisoft\ActiveRecord\ActiveRecordInterface $model, array|null &$properties )
$model Yiisoft\ActiveRecord\ActiveRecordInterface

The model being updated.

$properties array|null

List of property names or name-values pairs that need to be updated. If name-value pairs are specified, the values will be used for update. If null, the properties will be taken from the model.

                public function __construct(ActiveRecordInterface $model, public ?array &$properties)
{
    parent::__construct($model);
}

            
getReturnValue() public method

Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::getReturnValue()

Returns the value that will be returned by the method that triggered this event if the {@see AbstractEvent::isDefaultPrevented() default action is prevented}.

public mixed getReturnValue ( )

                public function getReturnValue(): mixed
{
    return $this->returnValue;
}

            
isDefaultPrevented() public method

Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::isDefaultPrevented()

Checks if the default action associated with this event has been prevented.

public boolean isDefaultPrevented ( )

                public function isDefaultPrevented(): bool
{
    return $this->isDefaultPrevented;
}

            
isPropagationStopped() public method
public boolean isPropagationStopped ( )

                public function isPropagationStopped(): bool
{
    return $this->isPropagationStopped;
}

            
preventDefault() public method

Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::preventDefault()

Prevents the default action associated with this event from being executed.

See also Yiisoft\ActiveRecord\Event\AbstractEvent::returnValue().

public void preventDefault ( )

                public function preventDefault(): void
{
    $this->isDefaultPrevented = true;
}

            
returnValue() public method

Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::returnValue()

Sets the return value which will be returned by the method that triggered this event if the {@see AbstractEvent::isDefaultPrevented() default action is prevented}.

See also Yiisoft\ActiveRecord\Event\AbstractEvent::preventDefault().

public void returnValue ( mixed $returnValue )
$returnValue mixed

                public function returnValue(mixed $returnValue): void
{
    $this->returnValue = $returnValue;
}

            
stopPropagation() public method

Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::stopPropagation()

Stops the propagation of the event to further listeners.

No further listeners will be notified after this method is called.

public void stopPropagation ( )

                public function stopPropagation(): void
{
    $this->isPropagationStopped = true;
}