改名
This commit is contained in:
@@ -495,7 +495,7 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->event->dispatch(self::BEFORE_SAVE, [$this])) {
|
if (!$this->event->dispatch(self::BEFORE_SAVE, [$this], $this)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ namespace Snowflake\Abstracts;
|
|||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
|
use JetBrains\PhpStorm\Pure;
|
||||||
|
use Snowflake\Exception\ComponentException;
|
||||||
use Snowflake\Snowflake;
|
use Snowflake\Snowflake;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,7 +52,7 @@ class Component extends BaseObject
|
|||||||
* @param null $callback
|
* @param null $callback
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function hasEvent($name, $callback = null): bool
|
#[Pure] public function hasEvent($name, $callback = null): bool
|
||||||
{
|
{
|
||||||
if (!isset($this->_events[$name])) {
|
if (!isset($this->_events[$name])) {
|
||||||
return false;
|
return false;
|
||||||
@@ -97,6 +99,7 @@ class Component extends BaseObject
|
|||||||
* @param $name
|
* @param $name
|
||||||
* @param null $handler
|
* @param null $handler
|
||||||
* @return void
|
* @return void
|
||||||
|
* @throws ComponentException
|
||||||
*/
|
*/
|
||||||
public function off($name, $handler = NULL): void
|
public function off($name, $handler = NULL): void
|
||||||
{
|
{
|
||||||
|
|||||||
+4
-3
@@ -174,11 +174,12 @@ class Event extends BaseObject
|
|||||||
/**
|
/**
|
||||||
* @param $name
|
* @param $name
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @return mixed
|
* @param null $scope
|
||||||
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function dispatch($name, $params = []): mixed
|
public function dispatch($name, $params = [], $scope = null): bool
|
||||||
{
|
{
|
||||||
return $this->trigger($name, $params);
|
return $this->trigger($name, $params, $scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user