本文整理汇总了PHP中Schema::addField方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::addField方法的具体用法?PHP Schema::addField怎么用?PHP Schema::addField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::addField方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: HarmoniRepositoryManager
/**
* Constructor
* @param array $configuration An array of the configuration options
* nessisary to load this manager. To use the a specific manager store, a
* store data source must be configured as noted in the class of said
* manager store.
* manager.
* @access public
*/
function HarmoniRepositoryManager($configuration = NULL)
{
// Define the type to use as a key for Identifying repositories
$this->repositoryKeyType = new HarmoniType("Repository", "edu.middlebury.harmoni", "Repository", "Nodes with this type are by definition Repositories.");
// Cache any created repositories so that we can pass out references to them.
$this->_createdRepositories = array();
$schemaMgr = Services::getService("SchemaManager");
$ids = Services::getService("Id");
$recordStructureId = $ids->getId("edu.middlebury.harmoni.repository.asset_content");
$recordDesc = "A RecordStructure for the generic content of an asset.";
if (!$schemaMgr->schemaExists($recordStructureId->getIdString())) {
// Create the Schema
$schema = new Schema($recordStructureId->getIdString(), "Repository Asset Content", 1, $recordDesc);
$schema->addField(new SchemaField("Content", "Content", "blob", "The binary content of the Asset"));
$schemaMgr->synchronize($schema);
// The SchemaManager only allows you to use Schemas created by it for use with Records.
$schema = $schemaMgr->getSchemaByID($recordStructureId->getIdString());
debug::output("RecordStructure is being created from Schema with Id: '" . $schema->getID() . "'");
$nullRepositoryId = $ids->getId('null');
$this->_createdRecordStructures[$schema->getID()] = new HarmoniRecordStructure($this, $schema, $nullRepositoryId);
// Add the parts to the schema
// $partStructureType = new Type("Repository", "edu.middlebury.harmoni", "Blob", "");
// $this->_createdRecordStructures[$schema->getID()]->createPartStructure(
// "Content",
// "The binary content of the Asset",
// $partStructureType,
// FALSE,
// FALSE,
// FALSE,
// $ids->getId("edu.middlebury.harmoni.repository.asset_content.Content")
// );
}
}
示例2: deepCopy
/**
* bla! - deepCopy baby!
* @return ref object
* @access public
*/
function deepCopy()
{
$schema = new Schema($this->getID(), $this->getDisplayName(), $this->getRevision(), $this->getDescription(), $this->getOtherParameters());
foreach (array_keys($this->_fields) as $key) {
$field = $this->_fields[$key];
$newField = $field->replicate();
$schema->addField($newField);
}
return $schema;
}
示例3: getSchema
function getSchema($id)
{
$id = strtolower($id);
$type = 'schema';
$row = $this->database->getSchemaDescription($id);
$typePage = $row[2];
$json = new Schema($row[0], $row[1], $row[2]);
if ($typePage == 'array') {
$json->addItems('type', 'object');
$properties = array();
} else {
unset($json->items);
}
$rows = $this->database->getFormFields($id, $type);
foreach ($rows as $row) {
$rowsI = $this->database->getFormFieldsTypes($id, $type, $row[0]);
if ($typePage == 'array') {
$properties[$row[0]] = $json->addField($rowsI);
} else {
$campo = $json->addField($rowsI);
$json->addProperties($row[0], $campo);
}
}
if ($typePage == 'array') {
$json->addItems("properties", $properties);
unset($json->properties);
}
return $json;
}