1
This commit is contained in:
@@ -134,7 +134,7 @@ abstract class AbstractCollection extends Component implements \IteratorAggregat
|
||||
return NULL;
|
||||
}
|
||||
if (!($this->_item[$offset] instanceof ModelInterface)) {
|
||||
return $this->model::populate($this->_item[$offset]);
|
||||
return $this->model->populates($this->_item[$offset]);
|
||||
}
|
||||
return $this->_item[$offset];
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class CollectionIterator extends \ArrayIterator
|
||||
*/
|
||||
protected function newModel($current): ModelInterface
|
||||
{
|
||||
return $this->model::populate($current);
|
||||
return $this->model->populates($current);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+13
-3
@@ -612,7 +612,6 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
*/
|
||||
public function save($data = NULL): static|bool
|
||||
{
|
||||
var_dump($this->_attributes);
|
||||
if (!is_null($data)) {
|
||||
$this->_attributes = merge($this->_attributes, $data);
|
||||
}
|
||||
@@ -621,13 +620,25 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
}
|
||||
[$change, $condition, $fields] = $this->separation();
|
||||
if (!$this->isNewExample) {
|
||||
var_dump($fields, $condition, $change);
|
||||
return $this->updateInternal($fields, $condition, $change);
|
||||
}
|
||||
return $this->insert($change, $fields);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
* @return $this
|
||||
*/
|
||||
public function populates($value): static
|
||||
{
|
||||
$this->_attributes = $value;
|
||||
$this->_oldAttributes = $value;
|
||||
$this->setIsCreate(FALSE);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param array|null $rule
|
||||
* @return bool
|
||||
@@ -846,7 +857,6 @@ abstract class Model extends Component implements ModelInterface, ArrayAccess, T
|
||||
public function refresh(): static
|
||||
{
|
||||
$this->_oldAttributes = $this->_attributes;
|
||||
var_dump($this->_attributes);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user