改名
This commit is contained in:
@@ -39,6 +39,13 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
||||
|
||||
protected ActiveQuery $query;
|
||||
|
||||
|
||||
public function clean()
|
||||
{
|
||||
unset($this->query, $this->model, $this->_item);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Collection constructor.
|
||||
*
|
||||
|
||||
@@ -27,6 +27,12 @@ class CollectionIterator extends \ArrayIterator
|
||||
private ActiveQuery $query;
|
||||
|
||||
|
||||
public function clean()
|
||||
{
|
||||
unset($this->query);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CollectionIterator constructor.
|
||||
* @param $model
|
||||
|
||||
@@ -51,6 +51,16 @@ class Pagination extends Component
|
||||
}
|
||||
|
||||
|
||||
public function clean()
|
||||
{
|
||||
unset($this->activeQuery, $this->_callback, $this->_group);
|
||||
$this->_offset = 0;
|
||||
$this->_limit = 100;
|
||||
$this->_max = 0;
|
||||
$this->_length = 0;;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array|Closure $callback
|
||||
* @throws Exception
|
||||
|
||||
@@ -44,6 +44,7 @@ class Relation extends Component
|
||||
* @param string $identification
|
||||
* @param $localValue
|
||||
* @return mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public function first(string $identification, $localValue): mixed
|
||||
{
|
||||
|
||||
@@ -9,7 +9,9 @@ use Closure;
|
||||
use HttpServer\Controller;
|
||||
use HttpServer\Http\Context;
|
||||
use HttpServer\Http\Request;
|
||||
use ReflectionException;
|
||||
use Snowflake\Exception\ComponentException;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
/**
|
||||
@@ -54,12 +56,12 @@ class Dispatch
|
||||
|
||||
|
||||
/**
|
||||
* 设置作用域
|
||||
* @throws ComponentException
|
||||
* @throws ReflectionException
|
||||
* @throws NotFindClassException
|
||||
*/
|
||||
protected function bind()
|
||||
{
|
||||
$class = $this->bindRequest(objectPool(Controller::class));
|
||||
$class = $this->bindRequest(Snowflake::createObject(Controller::class));
|
||||
$this->handler = Closure::bind($this->handler, $class);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace Snowflake\Pool;
|
||||
|
||||
use Exception;
|
||||
use ReflectionException;
|
||||
use Snowflake\Event;
|
||||
use Snowflake\Exception\NotFindClassException;
|
||||
use Snowflake\Snowflake;
|
||||
|
||||
@@ -37,7 +38,9 @@ class ObjectPool extends \Snowflake\Abstracts\Pool
|
||||
if (is_object($config)) {
|
||||
return $config;
|
||||
}
|
||||
return $this->getFromChannel(md5($config), [$config, $construct]);
|
||||
$object = $this->getFromChannel(md5($config), [$config, $construct]);
|
||||
listen(Event::EVENT_AFTER_REQUEST, [$object, 'clean']);
|
||||
return $object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user