static function fromArray($array) { if (isset($array['_attributes']['uri'])) { $obj = Data::read($array['_attributes']['uri']); } else { if (!isset($array['class'])) { $array['class'] = '\\boolive\\core\\data\\Entity'; } $obj = new $array['class'](); } if (!empty($array['_errors'])) { $obj->_errors = Error::createFromArray($array['_errors']); } if (isset($array['_children'])) { foreach ($array['_children'] as $key => $child) { $obj->_children[$key] = self::fromArray($child); $obj->_children[$key]->_parent = $obj; if ($obj->_children[$key]->_errors) { $obj->errors()->_children->add($obj->_children[$key]->_errors); } } } $obj->_attributes = $array['_attributes']; $obj->_changes = $array['_changes']; $obj->_checked = $array['_checked']; $obj->_auto_naming = $array['_auto_naming']; $obj->_is_inner = $array['_is_inner']; return $obj; }