private function fetchMappedCompositeEntities(EntityField $entityField, $id) { $multipleObjects = array(); foreach ($this->entityList[get_class($entityField->getCompositeEntity())] as $entity) { if ($entity->getParameterValue($entityField->getMappedByField()) == $id) { $multipleObjects[] = $this->fillEntity($entity); } } if (empty($multipleObjects)) { return null; } return $multipleObjects; }
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; }
$html .= "min = " . @$min[$i] . "<br>"; $html .= "max = " . @$max[$i] . "<br>"; $html .= "pattern = " . @$pattern[$i] . "<br>"; $html .= "unique = " . @$unique[$i] . "<br>"; $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]);
private function buildMappedBy(&$select, &$join, EntityField &$entityField, Entity $parentEntity) { $entityTbl = "moldp_" . $entityField->getMappedByEntity()->getTableName(); $select .= "," . $this->appendTableToEntityFields($entityField->getMappedByEntity()) . " "; $join .= " LEFT JOIN " . $entityField->getMappedByEntity()->getTableName() . " AS " . $entityTbl . " ON " . $entityTbl . "." . $entityField->getMappedByField() . " ="; $join .= " moldp_" . $parentEntity->getTableName() . "." . $parentEntity->getTableId()->getFieldName(); foreach ($entityField->getMappedByEntity()->getEntityFields() as $key => $subEntity) { if ($subEntity->isEager()) { $this->buildEntityJoin($select, $join, $subEntity, $entityField->getMappedByEntity()); } } }