本文整理汇总了PHP中Schema类的典型用法代码示例。如果您正苦于以下问题:PHP Schema类的具体用法?PHP Schema怎么用?PHP Schema使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Schema类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setDefaultUri
/**
* @param SchemaProperty $schemaprop
* @param Schema $schemaObj
*/
public function setDefaultUri($schemaprop, $schemaObj)
{
$newURI = $schemaObj->getNamespace();
$UriId = $schemaObj->getLastUriId() + 1;
$schemaprop->setUri($newURI . $UriId);
$this->setDefaultLexicalAlias($schemaprop, $newURI);
}
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:11,代码来源:actions.class.php
示例2: 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")
// );
}
}
开发者ID:adamfranco,项目名称:harmoni,代码行数:42,代码来源:HarmoniRepositoryManager.class.php
示例3: generateCoughClassesFromSchema
/**
* Generates Cough classes from a Schema object.
*
* @param Schema $schema
* @return void
* @author Anthony Bush
**/
public function generateCoughClassesFromSchema(Schema $schema)
{
foreach ($schema->getDatabases() as $database) {
foreach ($database->getTables() as $table) {
$this->generateCoughClassesFromSchemaTable($table);
}
}
}
开发者ID:jmhobbs,项目名称:MkLst,代码行数:15,代码来源:CoughGenerator.class.php
示例4: fixIndexes
/**
* Temporary hack to set up the compound index, since we can't do
* it yet through regular Schema interface. (Coming for 1.0...)
*
* @param Schema $schema
* @return void
*/
static function fixIndexes($schema)
{
try {
$schema->createIndex('submirror', array('subscribed', 'subscriber'));
} catch (Exception $e) {
common_log(LOG_ERR, __METHOD__ . ': ' . $e->getMessage());
}
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:15,代码来源:SubMirror.php
示例5: setDefaults
/**
* Set defaults
*
* @param Schema $schema
*/
public function setDefaults($schema)
{
$baseDomain = $this->getRequest()->getUriPrefix() . '/uri';
$schema->setBaseDomain($baseDomain . "/schema/");
$schema->setLanguage(sfConfig::get('app_default_language'));
$schema->setProfileId(sfConfig::get('app_schema_profile_id'));
parent::setDefaults($schema);
}
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:13,代码来源:actions.class.php
示例6: fixIndexes
/**
* Temporary hack to set up the compound index, since we can't do
* it yet through regular Schema interface. (Coming for 1.0...)
*
* @param Schema $schema
* @return void
*/
static function fixIndexes($schema)
{
try {
// @fixme this won't be a unique index... SIGH
$schema->createIndex('profile_detail', array('profile_id', 'field', 'field_index'));
} catch (Exception $e) {
common_log(LOG_ERR, __METHOD__ . ': ' . $e->getMessage());
}
}
开发者ID:microcosmx,项目名称:experiments,代码行数:16,代码来源:Profile_detail.php
示例7: compare
/**
* Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
*
* The returned diferences are returned in such a way that they contain the
* operations to change the schema stored in $fromSchema to the schema that is
* stored in $toSchema.
*
* @param Schema $fromSchema
* @param Schema $toSchema
*
* @return SchemaDiff
*/
public function compare(Schema $fromSchema, Schema $toSchema)
{
$diff = new SchemaDiff();
$foreignKeysToTable = array();
foreach ( $toSchema->getTables() AS $tableName => $table ) {
if ( !$fromSchema->hasTable($tableName) ) {
$diff->newTables[$tableName] = $table;
} else {
$tableDifferences = $this->diffTable( $fromSchema->getTable($tableName), $table );
if ( $tableDifferences !== false ) {
$diff->changedTables[$tableName] = $tableDifferences;
}
}
}
/* Check if there are tables removed */
foreach ( $fromSchema->getTables() AS $tableName => $table ) {
if ( !$toSchema->hasTable($tableName) ) {
$diff->removedTables[$tableName] = $table;
}
// also remember all foreign keys that point to a specific table
foreach ($table->getForeignKeys() AS $foreignKey) {
$foreignTable = strtolower($foreignKey->getForeignTableName());
if (!isset($foreignKeysToTable[$foreignTable])) {
$foreignKeysToTable[$foreignTable] = array();
}
$foreignKeysToTable[$foreignTable][] = $foreignKey;
}
}
foreach ($diff->removedTables AS $tableName => $table) {
if (isset($foreignKeysToTable[$tableName])) {
$diff->orphanedForeignKeys = array_merge($diff->orphanedForeignKeys, $foreignKeysToTable[$tableName]);
}
}
foreach ( $toSchema->getSequences() AS $sequenceName => $sequence) {
if (!$fromSchema->hasSequence($sequenceName)) {
$diff->newSequences[] = $sequence;
} else {
if ($this->diffSequence($sequence, $fromSchema->getSequence($sequenceName))) {
$diff->changedSequences[] = $fromSchema->getSequence($sequenceName);
}
}
}
foreach ($fromSchema->getSequences() AS $sequenceName => $sequence) {
if (!$toSchema->hasSequence($sequenceName)) {
$diff->removedSequences[] = $sequence;
}
}
return $diff;
}
开发者ID:rswharton,项目名称:Symfony2-Test,代码行数:69,代码来源:Comparator.php
示例8: validate
public static function validate($instance, $schema)
{
if ($schema) {
$s = new Schema();
$errors = $s->checkProperty($instance, $schema, '', '');
} else {
$errors = array(self::error('', 'No provided schema'));
}
return array('valid' => empty($errors) ? true : false, 'errors' => $errors);
}
开发者ID:jobywalker,项目名称:imperium,代码行数:10,代码来源:Schema.php
示例9: runStrategy
public function runStrategy()
{
$fname = Helper::get('savedir') . '/schema.php';
if (!file_exists($fname)) {
echo "File: {$fname} does not exist!\n";
exit;
}
$this->askForRewriteInformation();
require_once $fname;
$sc = new Schema();
$sc->load(Helper::getDbObject());
}
开发者ID:sdgdsffdsfff,项目名称:MMP,代码行数:12,代码来源:initController.class.php
示例10: deserializeTemporaryIds
public static function deserializeTemporaryIds(Schema $schema, $serializedIds)
{
$temporaryIdMap = new TemporaryIdMap();
foreach (explode("\n", $serializedIds) as $entry) {
$elements = explode(" ", $entry);
if (count($elements) == 3) {
$entity = $schema->getObjectEntity($elements[0]);
$temporaryIdMap->setId($entity, $elements[1], $elements[2]);
}
}
return $temporaryIdMap;
}
开发者ID:RobBosman,项目名称:bransom.RestServer-PHP,代码行数:12,代码来源:TemporaryIdMap.class.php
示例11: down
public function down()
{
Schema::table('posts', function (Blueprint $table) {
$table->dropForeign('posts_user_id_foreign');
});
Schema::drop('posts');
}
开发者ID:py1903,项目名称:My-Blog-Creator,代码行数:7,代码来源:2015_06_04_152043_create_posts_table.php
示例12: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('rss', function (Blueprint $table) {
$table->dropForeign('fk_rss_1');
$table->dropForeign('rss_ibfk_1');
});
}
开发者ID:vmariano,项目名称:shared-links-ranking,代码行数:12,代码来源:2014_10_11_130029_add_foreign_keys_to_rss_table.php
示例13: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn('oauth_flg');
$table->dropColumn('oauth_id');
});
}
开发者ID:ryamamoto,项目名称:laravel5-sample-tasklist,代码行数:12,代码来源:2015_12_02_132747_add_oauth_at_users_table.php
示例14: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('auditoriums', function (Blueprint $table) {
$table->renameColumn('address', 'direction');
$table->renameColumn('special_cost', 'especial_cost');
});
}
开发者ID:filmoteca,项目名称:filmoteca,代码行数:12,代码来源:2014_09_16_172244_rename_columna_especial_cost_to_special_cost_in_auditoriums.php
示例15: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('project_tasks', function (Blueprint $table) {
$table->date('start_date')->unsigned()->change();
$table->date('due_date')->unsigned()->change();
});
}
开发者ID:adrianodrix,项目名称:codeproject.dev,代码行数:12,代码来源:2015_09_25_025807_alter_project_tasks_table.php
示例16: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('category_permission');
Schema::drop('category_permission_role');
Schema::drop('category_permission_permission');
Schema::drop('category_permission_category');
}
开发者ID:fetch404,项目名称:fetch404,代码行数:12,代码来源:2015_04_22_171236_create_forum_permissions_table.php
示例17: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('information', function (Blueprint $table) {
$table->increments('id');
//ID
$table->string('name');
//İSİM
$table->string('slug');
//SLUG
$table->text('content');
//AÇIKLAMA
$table->integer('tabs_id');
//KATEGORİ ID
$table->integer('sort_order');
//SIRA
$table->integer('status');
//DURUMU
$table->integer('viewed');
//GORUNTULENME SAYISI
$table->text('meta_title');
//META BAŞLIK
$table->text('meta_description');
//META AÇIKLAMA
$table->text('meta_keywords');
//META A.KELİMELER
$table->softDeletes();
$table->timestamps();
});
}
开发者ID:ercancavusoglu,项目名称:laravel-ecommerce,代码行数:34,代码来源:2016_01_05_224454_create_information_table.php
示例18: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('tags', function ($t) {
$t->dropColumn('forum');
$t->dropColumn('articles');
});
}
开发者ID:sdlyhu,项目名称:laravelio,代码行数:12,代码来源:2013_10_30_104107_add_tag_section_fields.php
示例19: down
public function down()
{
Schema::table('partido_goles', function (Blueprint $table) {
$table->foreign('gol_autor')->references('pju_id')->on('partido_jugadores')->onDelete('restrict');
$table->foreign('gol_asistencia')->references('pju_id')->on('partido_jugadores')->onDelete('restrict');
});
}
开发者ID:00dav00,项目名称:marcadores-minimal,代码行数:7,代码来源:2016_02_04_012915_drop_fk_partido_goles_jugadores.php
示例20: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('aluminis', function (Blueprint $table) {
$table->dropForeign('aluminis_department_id_foreign');
$table->dropColumn('department_id');
});
}
开发者ID:kinnngg-lenz,项目名称:csacerc,代码行数:12,代码来源:2016_03_03_064630_add_department_to_aluminis_table.php
注:本文中的Schema类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论