diff --git a/~dev_rating/application/classes/Model/Helper/Builder.php b/~dev_rating/application/classes/Model/Helper/Builder.php index 2aa990852f32812207366f22115d439656c464a4..96127e730100cdcca9d6df49b94e4ce498bd2341 100644 --- a/~dev_rating/application/classes/Model/Helper/Builder.php +++ b/~dev_rating/application/classes/Model/Helper/Builder.php @@ -10,4 +10,20 @@ class Model_Helper_Builder extends Model // Variable, allows to create new instance in db $this->data = [self::$create_new => true]; } + + /** + * @param array $map + * @return $this + * @throws InvalidArgumentException + */ + public function fromSet(array $map) { + foreach ($map as $name => $value) { + if ($name === '__construct' || $name === 'fromSet' || $name === 'create') + throw new InvalidArgumentException("`$name` field is incorrect"); + if (method_exists($this, $name)) + $this->{$name}($value); + } + + return $this; + } } \ No newline at end of file