Compare commits
4 Commits
2.2.4
...
bc006f3e01
Author | SHA1 | Date | |
---|---|---|---|
bc006f3e01 | |||
23c56f9511 | |||
4ccc38ffac | |||
ef1603bc4b |
@ -151,6 +151,9 @@ abstract class Repository implements RepositoryInterface
|
|||||||
{
|
{
|
||||||
foreach ($this->getRequired() as $column) {
|
foreach ($this->getRequired() as $column) {
|
||||||
$m = $this->getMethod($column, false);
|
$m = $this->getMethod($column, false);
|
||||||
|
if (!method_exists($model, $m)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$model->{$m}($data[$column]);
|
$model->{$m}($data[$column]);
|
||||||
}
|
}
|
||||||
foreach ($this->getOptional() as $column) {
|
foreach ($this->getOptional() as $column) {
|
||||||
@ -158,6 +161,9 @@ abstract class Repository implements RepositoryInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$m = $this->getMethod($column, false);
|
$m = $this->getMethod($column, false);
|
||||||
|
if (!method_exists($model, $m)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$model->{$m}($data[$column]);
|
$model->{$m}($data[$column]);
|
||||||
}
|
}
|
||||||
return $model;
|
return $model;
|
||||||
@ -169,6 +175,9 @@ abstract class Repository implements RepositoryInterface
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$m = $this->getMethod($column);
|
$m = $this->getMethod($column);
|
||||||
|
if (!method_exists($model, $m)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$val = $model->{$m}();
|
$val = $model->{$m}();
|
||||||
$data[$column] = $val;
|
$data[$column] = $val;
|
||||||
}
|
}
|
||||||
@ -217,6 +226,9 @@ abstract class Repository implements RepositoryInterface
|
|||||||
foreach ($this->getColumns() as $col) {
|
foreach ($this->getColumns() as $col) {
|
||||||
if (isset($data[$col])) {
|
if (isset($data[$col])) {
|
||||||
$m = $this->getMethod($col, false);
|
$m = $this->getMethod($col, false);
|
||||||
|
if (!method_exists($model, $m)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$model->{$m}($data[$col]);
|
$model->{$m}($data[$col]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,7 +247,7 @@ abstract class Repository implements RepositoryInterface
|
|||||||
->from($this->getTable())
|
->from($this->getTable())
|
||||||
->where(['id = ?'])
|
->where(['id = ?'])
|
||||||
->limit(1);
|
->limit(1);
|
||||||
return $this->load($this->getConnection()->execute($query, [$id])->getAsArray()[0]);
|
return $this->load($this->getConnection()->execute($query, [$id])->getFirstAsArray());
|
||||||
}
|
}
|
||||||
public function fetchAll(): array
|
public function fetchAll(): array
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user