1
This commit is contained in:
@@ -56,7 +56,7 @@ class CollectionIterator extends \ArrayIterator
|
||||
*/
|
||||
protected function newModel($current): ModelInterface
|
||||
{
|
||||
return $this->model->attributes = $current;
|
||||
return $this->model->setAttributes($current);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+10
-13
@@ -120,10 +120,11 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
*/
|
||||
/**
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return mixed
|
||||
*/
|
||||
private function _setter(string $name, mixed $value): mixed
|
||||
{
|
||||
$method = di(Setter::class)->getSetter(static::class, $name);
|
||||
@@ -488,7 +489,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
*/
|
||||
public function setAttribute($name, $value): mixed
|
||||
{
|
||||
return $this->_attributes[$name] = $this->_setter($name, $value);
|
||||
return $this->_attributes[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -498,7 +499,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
*/
|
||||
public function setOldAttribute($name, $value): mixed
|
||||
{
|
||||
return $this->_oldAttributes[$name] = $this->_setter($name, $value);
|
||||
return $this->_oldAttributes[$name] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -511,9 +512,7 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
if (empty($param)) {
|
||||
return $this;
|
||||
}
|
||||
foreach ($param as $key => $value) {
|
||||
$this->_attributes[$key] = $this->_setter($key, $value);
|
||||
}
|
||||
$this->_attributes = $param;
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -526,10 +525,8 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
if (empty($param) || !is_array($param)) {
|
||||
return $this;
|
||||
}
|
||||
foreach ($param as $key => $val) {
|
||||
$this->setOldAttribute($key, $val);
|
||||
}
|
||||
return $this;
|
||||
$this->_oldAttributes = $param;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user