Final Class Yiisoft\ActiveRecord\Event\BeforeInsert
| Inheritance | Yiisoft\ActiveRecord\Event\BeforeInsert » Yiisoft\ActiveRecord\Event\AbstractEvent |
|---|---|
| Implements | Psr\EventDispatcher\StoppableEventInterface |
Event triggered before a new record is inserted into the database.
It allows to modify properties that will be used for {@see \Yiisoft\ActiveRecord\ActiveRecordInterface::insert()} operation.
See also Yiisoft\ActiveRecord\ActiveRecordInterface::insert().
Public Properties
| Property | Type | Description | Defined By |
|---|---|---|---|
| $model | Yiisoft\ActiveRecord\ActiveRecordInterface | Yiisoft\ActiveRecord\Event\AbstractEvent | |
| $properties | array|null | Yiisoft\ActiveRecord\Event\BeforeInsert |
Public Methods
| Method | Description | Defined By |
|---|---|---|
| __construct() | Yiisoft\ActiveRecord\Event\BeforeInsert | |
| getReturnValue() | Returns the value that will be returned by the method that triggered this event if the {@see 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 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
| public mixed __construct ( Yiisoft\ActiveRecord\ActiveRecordInterface $model, array|null &$properties ) | ||
| $model | Yiisoft\ActiveRecord\ActiveRecordInterface |
The model that is being inserted. |
| $properties | array|null |
The properties that will be used for the insert operation. |
public function __construct(ActiveRecordInterface $model, public ?array &$properties)
{
parent::__construct($model);
}
Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::getReturnValue()
Returns the value that will be returned by the method that triggered this event if the {@see isDefaultPrevented() default action is prevented}.
| public mixed getReturnValue ( ) |
public function getReturnValue(): mixed
{
return $this->returnValue;
}
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;
}
| public boolean isPropagationStopped ( ) |
public function isPropagationStopped(): bool
{
return $this->isPropagationStopped;
}
Defined in: Yiisoft\ActiveRecord\Event\AbstractEvent::preventDefault()
Prevents the default action associated with this event from being executed.
See also returnValue().
| public void preventDefault ( ) |
public function preventDefault(): void
{
$this->isDefaultPrevented = true;
}
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 isDefaultPrevented() default action is prevented}.
See also preventDefault().
| public void returnValue ( mixed $returnValue ) | ||
| $returnValue | mixed | |
public function returnValue(mixed $returnValue): void
{
$this->returnValue = $returnValue;
}
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;
}
Signup or Login in order to comment.