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];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+6
-2
@@ -512,7 +512,9 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
|||||||
if (empty($param)) {
|
if (empty($param)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$this->_attributes = $param;
|
foreach ($this->_attributes as $key => $attribute) {
|
||||||
|
$this->_attributes[$key] = $this->_setter($key, $attribute);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -525,7 +527,9 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
|||||||
if (empty($param) || !is_array($param)) {
|
if (empty($param) || !is_array($param)) {
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
$this->_oldAttributes = $param;
|
foreach ($this->_oldAttributes as $key => $attribute) {
|
||||||
|
$this->_oldAttributes[$key] = $this->_setter($key, $attribute);
|
||||||
|
}
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user