0 follower

Abstract Class Yiisoft\ActiveRecord\Event\AbstractEvent

InheritanceYiisoft\ActiveRecord\Event\AbstractEvent
ImplementsPsr\EventDispatcher\StoppableEventInterface
SubclassesYiisoft\ActiveRecord\Event\AfterCreateQuery, Yiisoft\ActiveRecord\Event\AfterDelete, Yiisoft\ActiveRecord\Event\AfterInsert, Yiisoft\ActiveRecord\Event\AfterPopulate, Yiisoft\ActiveRecord\Event\AfterSave, Yiisoft\ActiveRecord\Event\AfterUpdate, Yiisoft\ActiveRecord\Event\AfterUpsert, Yiisoft\ActiveRecord\Event\BeforeCreateQuery, Yiisoft\ActiveRecord\Event\BeforeDelete, Yiisoft\ActiveRecord\Event\BeforeInsert, Yiisoft\ActiveRecord\Event\BeforePopulate, Yiisoft\ActiveRecord\Event\BeforeSave, Yiisoft\ActiveRecord\Event\BeforeUpdate, Yiisoft\ActiveRecord\Event\BeforeUpsert

Base class for events in Active Record models.

Public Methods

Hide inherited methods

Method Description Defined By
__construct() Yiisoft\ActiveRecord\Event\AbstractEvent
getReturnValue() Returns the value that will be returned by the method that triggered this event if the 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 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

Method Details

Hide inherited methods

__construct() public method

public __construct( Yiisoft\ActiveRecord\ActiveRecordInterface $model ): mixed
$model Yiisoft\ActiveRecord\ActiveRecordInterface

The target model associated with this event.

                public function __construct(
    public readonly ActiveRecordInterface $model,
) {}

            
getReturnValue() public method

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

public getReturnValue( ): mixed

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

            
isDefaultPrevented() public method

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

public isDefaultPrevented( ): boolean

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

            
isPropagationStopped() public method

public isPropagationStopped( ): boolean

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

            
preventDefault() public method

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

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

public preventDefault( ): void

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

            
returnValue() public method

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

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

public returnValue( mixed $returnValue ): void
$returnValue mixed

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

            
stopPropagation() public method

Stops the propagation of the event to further listeners.

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

public stopPropagation( ): void

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