$html .= "example = " . @$example[$i] . "<br>"; $html .= "foreign_key = " . @$foreign_key[$i] . "<br>"; $html .= "foreign_value = " . @$foreign_value[$i] . "<br>"; $html .= "]<br><br>"; if (empty($key[$i])) { $errs[] = "Missing \"Key\" in row " . ($i + 1); } else { if (empty($display_name[$i])) { $errs[] = "Missing \"Display Name\" for \"{$key[$i]}\""; } } $field = new EntityField($key[$i]); $field->setDisplayName($display_name[$i]); $field->setDataType($data_type[$i]); if (@$required[$i] == "true") { $field->setRequired(TRUE); } else { $field->setRequired(FALSE); } $field->setMin($min[$i]); $field->setMax($max[$i]); if (@$unique[$i] == "true") { $field->setUnique(TRUE); } else { $field->setUnique(FALSE); } $field->setExample($example[$i]); $field->setForeignKey($foreign_key[$i]); $field->setForeignValue($foreign_value[$i]); switch ($data_type[$i]) { case "string":
private static function parseJoinBlueprint($xml) { $blueprint = new JoinBlueprint((string) $xml['key']); // iterate through blueprints fields, defining them in blueprint object foreach ($xml->field as $f) { $field = new EntityField((string) $f['key']); // common $field->setDisplayName((string) $f->displayName); $field->setDataType((string) $f->dataType); $field->setMimeType((string) $f->mimeType); $field->setPrecision((string) $f->precision); $encType = (string) $f->encType; if (!empty($encType)) { $field->setEncType((string) $f->encType); } $required = (string) $f->required; if (strtolower($required) == "true") { $field->setRequired(true); } else { $field->setRequired(false); } //$field->setMin((string) $f->minimum); $minimum = (string) $f->minimum; if (!empty($minimum)) { $field->setMin($minimum); } //$field->setMax((string) $f->maximum); $maximum = (string) $f->maximum; if (!empty($maximum)) { $field->setMax($maximum); } $field->setRegexp((string) $f->regexp); $field->setExample((string) $f->example); $unique = (string) $f->unique; if (strtolower($unique) == "true") { $field->setUnique(true); } else { $field->setUnique(false); } $field->setForeignKey((string) $f->foreignKey); $field->setForeignValue((string) $f->foreignValue); if ($field->getDataType() == "enum") { $enumOptions = array(); foreach ($f->enumOptions->option as $option) { $enumOptions[] = (string) $option; } $field->setEnumOptions($enumOptions); } $blueprint->add($field); } return $blueprint; }