Exemple #1
2
 /**
  * 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;
 }
 /**
  * @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);
 }
 /**
  * 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")
         //																);
     }
 }
Exemple #4
1
 public function testParseXml()
 {
     $this->object->load($this->fileName, null, true);
     $xml = $this->object->parseXml();
     $xml->formatOutput = true;
     echo $xml->saveXML();
 }
 /**
  * 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);
         }
     }
 }
 /**
  * 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());
     }
 }
 /**
 * 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);
 }
 /**
  * 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());
     }
 }
    /**
     * 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;
    }
Exemple #10
1
 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);
 }
 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());
 }
 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;
 }
 public function down()
 {
     Schema::table('posts', function (Blueprint $table) {
         $table->dropForeign('posts_user_id_foreign');
     });
     Schema::drop('posts');
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('rss', function (Blueprint $table) {
         $table->dropForeign('fk_rss_1');
         $table->dropForeign('rss_ibfk_1');
     });
 }
 /**
  * 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');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->dropColumn('oauth_flg');
         $table->dropColumn('oauth_id');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('auditoriums', function (Blueprint $table) {
         $table->renameColumn('address', 'direction');
         $table->renameColumn('special_cost', 'especial_cost');
     });
 }
 /**
  * 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();
     });
 }
 /**
  * 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');
 }
 /**
  * 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();
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('tags', function ($t) {
         $t->dropColumn('forum');
         $t->dropColumn('articles');
     });
 }
 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');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('aluminis', function (Blueprint $table) {
         $table->dropForeign('aluminis_department_id_foreign');
         $table->dropColumn('department_id');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('users', function (Blueprint $table) {
         $table->dropColumn('phone');
         $table->dropColumn('facebook');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('bookings', function ($table) {
         $table->dropColumn('book_from');
         $table->dropColumn('book_to');
     });
 }
 /**
  * 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');
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     //
     Schema::table('landing', function (Blueprint $table) {
         $table->integer('class_number')->default(1);
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('musics', function (Blueprint $table) {
         $table->dropColumn('section_duration');
         $table->dropColumn('track');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('tests', function (Blueprint $table) {
         //
         $table->dropColumn('time');
     });
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     Schema::table('interview', function (Blueprint $t) {
         $t->dropForeign('location_id');
         $t->dropColumn('location_id');
     });
 }