改名
This commit is contained in:
@@ -312,6 +312,10 @@ class ActiveRecord extends BaseActiveRecord
|
|||||||
$data[$key] = $this->{$item}($data[$key] ?? null);
|
$data[$key] = $this->{$item}($data[$key] ?? null);
|
||||||
}
|
}
|
||||||
$data = array_merge($data, $this->runRelate());
|
$data = array_merge($data, $this->runRelate());
|
||||||
|
|
||||||
|
$class = Snowflake::app()->getChannel();
|
||||||
|
$class->push($this, static::class);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1060,8 +1060,11 @@ abstract class BaseActiveRecord extends Component implements IOrm, ArrayAccess
|
|||||||
*/
|
*/
|
||||||
public static function populate(array $data): static
|
public static function populate(array $data): static
|
||||||
{
|
{
|
||||||
|
$class = Snowflake::app()->getChannel();
|
||||||
/** @var static $model */
|
/** @var static $model */
|
||||||
$model = Snowflake::createObject(static::class);
|
$model = $class->pop(static::class, function () {
|
||||||
|
return new static();
|
||||||
|
});
|
||||||
$model->_attributes = $data;
|
$model->_attributes = $data;
|
||||||
$model->_oldAttributes = $data;
|
$model->_oldAttributes = $data;
|
||||||
$model->setIsCreate(false);
|
$model->setIsCreate(false);
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ class Channel extends Component
|
|||||||
*/
|
*/
|
||||||
public function push(mixed $value, string $name = ''): void
|
public function push(mixed $value, string $name = ''): void
|
||||||
{
|
{
|
||||||
unset($value);
|
|
||||||
return;
|
|
||||||
$channel = $this->channelInit($name);
|
$channel = $this->channelInit($name);
|
||||||
$channel->enqueue($value);
|
$channel->enqueue($value);
|
||||||
}
|
}
|
||||||
@@ -75,8 +73,6 @@ class Channel extends Component
|
|||||||
*/
|
*/
|
||||||
public function pop(string $name, Closure $closure, int|float $timeout = null): mixed
|
public function pop(string $name, Closure $closure, int|float $timeout = null): mixed
|
||||||
{
|
{
|
||||||
return call_user_func($closure);
|
|
||||||
|
|
||||||
if (($channel = $this->channelInit($name)) == false) {
|
if (($channel = $this->channelInit($name)) == false) {
|
||||||
return $this->addError('Channel is full.');
|
return $this->addError('Channel is full.');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user