PHP Class Schema, someline-starter Code Examples

This page contains top rated real world PHP examples of class Schema from package someline-starter extracted from open source projects. You can rate examples to help us improve the quality of examples
Frequently Used Methods
Example #1
Show file File: SchemaWriter.php Project: sigma-z/dive
1
 /**
  * gets schema formatted content
  *
  * @return string
  */
 public function getContent()
 {
     $schemaDefinition = $this->schema->toArray();
     $content = \Dive\Util\VarExport::export($schemaDefinition, array('removeLastComma' => true));
     $content = "<?php\n\nreturn {$content};";
     return $content;
 }
Example #2
Show file File: actions.class.php Project: jonphipps/Metadata-Registry
0
 /**
  * @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);
 }
Example #3
Show file File: HarmoniRepositoryManager.class.php Project: adamfranco/harmoni
0
 /**
  * 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")
         //																);
     }
 }
Example #4
Show file File: SchemaTest.php Project: charlanalves/sped
0
 public function testParseXml()
 {
     $this->object->load($this->fileName, null, true);
     $xml = $this->object->parseXml();
     $xml->formatOutput = true;
     echo $xml->saveXML();
 }
Example #5
Show file File: CoughGenerator.class.php Project: jmhobbs/MkLst
0
 /**
  * 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);
         }
     }
 }
Example #6
Show file File: SubMirror.php Project: bashrc/gnusocial-debian
0
 /**
  * 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());
     }
 }
Example #7
Show file File: actions.class.php Project: jonphipps/Metadata-Registry
0
 /**
 * 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);
 }
Example #8
Show file File: Profile_detail.php Project: microcosmx/experiments
0
 /**
  * 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());
     }
 }
Example #9
Show file File: Comparator.php Project: rswharton/Symfony2-Test
0
    /**
     * 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;
    }
Example #10
Show file File: Schema.php Project: jobywalker/imperium
0
 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);
 }
Example #11
Show file File: initController.class.php Project: sdgdsffdsfff/MMP
0
 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());
 }
Example #12
Show file File: TemporaryIdMap.class.php Project: RobBosman/bransom.RestServer-PHP
0
 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;
 }
Example #13
Show file File: 2015_06_04_152043_create_posts_table.php Project: py1903/My-Blog-Creator
0
 public function down()
 {
     Schema::table('posts', function (Blueprint $table) {
         $table->dropForeign('posts_user_id_foreign');
     });
     Schema::drop('posts');
 }
Example #14
Show file File: 2014_10_11_130029_add_foreign_keys_to_rss_table.php Project: vmariano/shared-links-ranking
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('rss', function (Blueprint $table) {
         $table->dropForeign('fk_rss_1');
         $table->dropForeign('rss_ibfk_1');
     });
 }
Example #15
Show file File: 2015_10_26_173423_add_foreign_keys_to_reg_vocabulary_has_version_table.php Project: jonphipps/api-registry
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('reg_vocabulary_has_version', function (Blueprint $table) {
         $table->dropForeign('reg_vocabulary_has_version_ibfk_1');
         $table->dropForeign('reg_vocabulary_has_version_ibfk_2');
     });
 }
Example #16
Show file File: 2015_12_02_132747_add_oauth_at_users_table.php Project: ryamamoto/laravel5-sample-tasklist
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->dropColumn('oauth_flg');
         $table->dropColumn('oauth_id');
     });
 }
Example #17
Show file File: 2014_09_16_172244_rename_columna_especial_cost_to_special_cost_in_auditoriums.php Project: filmoteca/filmoteca
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('auditoriums', function (Blueprint $table) {
         $table->renameColumn('address', 'direction');
         $table->renameColumn('special_cost', 'especial_cost');
     });
 }
Example #18
Show file File: 2015_09_25_025807_alter_project_tasks_table.php Project: adrianodrix/codeproject.dev
0
 /**
  * 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();
     });
 }
Example #19
Show file File: 2015_04_22_171236_create_forum_permissions_table.php Project: fetch404/fetch404
0
 /**
  * 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');
 }
Example #20
Show file File: 2016_01_05_224454_create_information_table.php Project: ercancavusoglu/laravel-ecommerce
0
 /**
  * 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();
     });
 }
Example #21
Show file File: 2013_10_30_104107_add_tag_section_fields.php Project: sdlyhu/laravelio
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('tags', function ($t) {
         $t->dropColumn('forum');
         $t->dropColumn('articles');
     });
 }
Example #22
Show file File: 2016_02_04_012915_drop_fk_partido_goles_jugadores.php Project: 00dav00/marcadores-minimal
0
 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');
     });
 }
Example #23
Show file File: 2016_03_03_064630_add_department_to_aluminis_table.php Project: kinnngg-lenz/csacerc
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('aluminis', function (Blueprint $table) {
         $table->dropForeign('aluminis_department_id_foreign');
         $table->dropColumn('department_id');
     });
 }
Example #24
Show file File: 2015_12_15_173640_add_user_columns.php Project: punkrockio/Sample-Web-App
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->dropColumn('phone');
         $table->dropColumn('facebook');
     });
 }
Example #25
Show file File: 2014_03_02_154438_add_book_from_to_cols_bookings_table.php Project: madiarsa/laravel-4.1-car-rental-site
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('bookings', function ($table) {
         $table->dropColumn('book_from');
         $table->dropColumn('book_to');
     });
 }
Example #26
Show file File: 2015_09_02_131456_add_tiers_to_stack_actions_table.php Project: Hoasted/laravel-5-boilerplate
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('stack_actions', function (Blueprint $table) {
         $table->dropForeign('stack_actions_tier_id_foreign');
         $table->dropColumn('tier_id');
     });
 }
Example #27
Show file File: 2016_05_28_145709_add_class_number_to_landing.php Project: Kaelcao/colormev2
0
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     //
     Schema::table('landing', function (Blueprint $table) {
         $table->integer('class_number')->default(1);
     });
 }
Example #28
Show file File: 2016_04_08_024641_add_section_duration_and_track_column_to_musics_table.php Project: WangWeigao/m1
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('musics', function (Blueprint $table) {
         $table->dropColumn('section_duration');
         $table->dropColumn('track');
     });
 }
Example #29
Show file File: 2015_11_14_103417_add_time_tests_table.php Project: simple-code-simple/blog
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('tests', function (Blueprint $table) {
         //
         $table->dropColumn('time');
     });
 }
Example #30
Show file File: 2015_05_18_100452_add_location_id_to_responses.php Project: mymedialab/listenings
0
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('interview', function (Blueprint $t) {
         $t->dropForeign('location_id');
         $t->dropColumn('location_id');
     });
 }