diff --git a/src/Modler/Model.php b/src/Modler/Model.php index ed34a73..edeacf1 100644 --- a/src/Modler/Model.php +++ b/src/Modler/Model.php @@ -35,15 +35,15 @@ public function __construct(array $data = array()) $this->load($data); } } - + /** * Checks if a given property is set on the model. - * + * * @param string $name Property name */ - public function __isset($name) + public function __isset($name) { - return array_key_exists($name, $this->properties); + return array_key_exists($name, $this->properties); } /** @@ -270,6 +270,12 @@ public function load(array $data, $enforceGuard = true) { if (array_key_exists($name, $this->properties)) { $property = $this->properties[$name]; + + $method = 'load'.ucwords($name); + if (method_exists($this, $method) == true) { + $value = $this->$method($value); + } + if ($enforceGuard === true) { if (!isset($property['guarded']) || (isset($property['guarded']) && $property['guarded'] === false)