1
This commit is contained in:
@@ -134,7 +134,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!($this->_item[$offset] instanceof ModelInterface)) {
|
if (!($this->_item[$offset] instanceof ModelInterface)) {
|
||||||
return $this->model->setAttributes($this->_item[$offset]);
|
return $this->model::populate($this->_item[$offset]);
|
||||||
}
|
}
|
||||||
return $this->_item[$offset];
|
return $this->_item[$offset];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ use Exception;
|
|||||||
class CollectionIterator extends \ArrayIterator
|
class CollectionIterator extends \ArrayIterator
|
||||||
{
|
{
|
||||||
|
|
||||||
private ModelInterface|string $model;
|
private \Database\Model|string $model;
|
||||||
|
|
||||||
|
|
||||||
/** @var ActiveQuery */
|
/** @var ActiveQuery */
|
||||||
@@ -56,7 +56,7 @@ class CollectionIterator extends \ArrayIterator
|
|||||||
*/
|
*/
|
||||||
protected function newModel($current): ModelInterface
|
protected function newModel($current): ModelInterface
|
||||||
{
|
{
|
||||||
return $this->model->setAttributes($current);
|
return $this->model::populate($current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -646,7 +646,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
|||||||
private function resolve($rule): Validator
|
private function resolve($rule): Validator
|
||||||
{
|
{
|
||||||
$validate = Validator::getInstance();
|
$validate = Validator::getInstance();
|
||||||
$validate->setParams($this->_attributes);
|
$validate->setParams($this->getAttributes());
|
||||||
$validate->setModel($this);
|
$validate->setModel($this);
|
||||||
foreach ($rule as $val) {
|
foreach ($rule as $val) {
|
||||||
$field = array_shift($val);
|
$field = array_shift($val);
|
||||||
|
|||||||
Reference in New Issue
Block a user