diff --git a/src/Alias/Model/Repository.php b/src/Alias/Model/Repository.php index 1e75b02..250ab39 100644 --- a/src/Alias/Model/Repository.php +++ b/src/Alias/Model/Repository.php @@ -151,6 +151,9 @@ abstract class Repository implements RepositoryInterface { foreach ($this->getRequired() as $column) { $m = $this->getMethod($column, false); + if (!method_exists($model, $m)) { + continue; + } $model->{$m}($data[$column]); } foreach ($this->getOptional() as $column) { @@ -158,6 +161,9 @@ abstract class Repository implements RepositoryInterface continue; } $m = $this->getMethod($column, false); + if (!method_exists($model, $m)) { + continue; + } $model->{$m}($data[$column]); } return $model; @@ -169,6 +175,9 @@ abstract class Repository implements RepositoryInterface continue; } $m = $this->getMethod($column); + if (!method_exists($model, $m)) { + continue; + } $val = $model->{$m}(); $data[$column] = $val; } @@ -217,6 +226,9 @@ abstract class Repository implements RepositoryInterface foreach ($this->getColumns() as $col) { if (isset($data[$col])) { $m = $this->getMethod($col, false); + if (!method_exists($model, $m)) { + continue; + } $model->{$m}($data[$col]); } }