当前位置: 首页>>代码示例>>PHP>>正文


PHP Schema::save方法代码示例

本文整理汇总了PHP中Schema::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::save方法的具体用法?PHP Schema::save怎么用?PHP Schema::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema::save方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setPrefixes

 /**
  * @param array $prefixes
  */
 public function setPrefixes($prefixes)
 {
     if ($prefixes) {
         $this->prefixes = $prefixes;
         $this->schema->setPrefixes($prefixes);
         $this->schema->save();
     }
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:11,代码来源:ExportVocab.php

示例2: doSave

 /**
  * Stores the object in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      Connection $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave($con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aUser !== null) {
             if ($this->aUser->isModified()) {
                 $affectedRows += $this->aUser->save($con);
             }
             $this->setUser($this->aUser);
         }
         if ($this->aSchema !== null) {
             if ($this->aSchema->isModified()) {
                 $affectedRows += $this->aSchema->save($con);
             }
             $this->setSchema($this->aSchema);
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = SchemaHasVersionPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += SchemaHasVersionPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         $this->alreadyInSave = false;
     }
     return $affectedRows;
 }
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:54,代码来源:BaseSchemaHasVersion.php

示例3: run_import_list


//.........这里部分代码省略.........
                $fields   = VocabularyPeer::getFieldNames();

                try {
                    while ($row = $reader->getRow()) {
                        //        lookup the URI (or the OMR ID if available) for a match
                        if (empty($row["VES"])) {
                            //skip this one
                            break;
                        }

                        $uri        = $baseDomain . $row["VES"] . "#";
                        $vocab      = VocabularyPeer::getVocabularyByUri($uri);
                        $updateTime = time();

                        if (! $vocab) {
                            //          create a new concept or element
                            $vocab = new Vocabulary();
                            $vocab->setUri($uri);
                            $vocab->setCreatedAt($updateTime);
                            $vocab->setCreatedUserId($userId);
                            $vocab->setAgentId($agentID);
                            $vocab->setBaseDomain($baseDomain);
                            $vocab->setCommunity("Libraries, MARC21");
                            $vocab->setLanguage("en");
                            $vocab->setStatusId(1);
                        } else {
                            $vocab->setLastUpdated($updateTime);
                            $vocab->setUpdatedUserId($userId);
                        }

                        $vocab->setName(fixEncoding(rtrim($row['Name'])));
                        $vocab->setNote(fixEncoding(rtrim($row['Note'])));
                        $vocab->setToken($row['VES']);
                        $vocab->save();

                        //type
                        $args[0] = "vocab";
                        //vocabid
                        $args[2] = $vocab->getId();
                        //filepath
                        $args[1] = $GLOBALS['uploadPath'] . $row['VES'] . ".csv";
                        $args[3] = $batchId;
                        $args[4] = "-d";

                        run_import_vocabulary($importTask, $args);
                        $foo = $vocab->countConcepts();
                    }
                } catch(Exception $e) {
                    throw new Exception($e);
                }
            } else //it's a schema
            {
                try {
                    while ($row = $reader->getRow()) {

                        //NOTE: this is explicitly tuned to a particular import file
                        //TODO: generalize this import mapping

                        // lookup the URI (or the OMR ID if available) for a match
                        if (empty($row["URI"])) {
                            //skip this one
                            break;
                        }

                        $uri        = $row["URI"];
                        $schema     = SchemaPeer::getschemaByUri($uri);
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:67,代码来源:importVocabulary.php

示例4: testUpdateFails

 /**
  * Tests to fail updating.
  */
 public function testUpdateFails()
 {
     // Create new schema
     $schema = new Schema(array('SCHEMA_NAME' => 'schematest1'));
     // Save schema
     $schema->save();
     // Change schema charset to something non-existing
     $schema->DEFAULT_COLLATION_NAME = md5(microtime());
     // Try to save
     $schema->save();
     // Schema should have errors
     $this->assertEquals(true, $schema->hasErrors());
 }
开发者ID:cebe,项目名称:chive,代码行数:16,代码来源:SchemaTest.php

示例5: actionCreate

 /**
  * Create a new schema.
  */
 public function actionCreate()
 {
     $schema = new Schema();
     if (isset($_POST['Schema'])) {
         $schema->attributes = $_POST['Schema'];
         if ($sql = $schema->save()) {
             $response = new AjaxResponse();
             $response->addNotification('success', Yii::t('core', 'successAddSchema', array('{schema}' => $schema->SCHEMA_NAME)), null, $sql);
             $response->refresh = true;
             $response->executeJavaScript('sideBar.loadSchemata()');
             $this->sendJSON($response);
         }
     }
     $collations = Collation::model()->findAll(array('order' => 'COLLATION_NAME', 'select' => 'COLLATION_NAME, CHARACTER_SET_NAME AS collationGroup'));
     $this->render('form', array('schema' => $schema, 'collations' => $collations));
 }
开发者ID:cebe,项目名称:chive,代码行数:19,代码来源:SchemaController.php

示例6: doSave

 /**
  * Stores the object in the database.
  *
  * If the object is new, it inserts it; otherwise an update is performed.
  * All related objects are also updated in this method.
  *
  * @param      Connection $con
  * @return     int The number of rows affected by this insert/update and any referring fk objects' save() operations.
  * @throws     PropelException
  * @see        save()
  */
 protected function doSave($con)
 {
     $affectedRows = 0;
     // initialize var to track total num of affected rows
     if (!$this->alreadyInSave) {
         $this->alreadyInSave = true;
         // We call the save method on the following object(s) if they
         // were passed to this object by their coresponding set
         // method.  This object relates to these object(s) by a
         // foreign key reference.
         if ($this->aUserRelatedByCreatedUserId !== null) {
             if ($this->aUserRelatedByCreatedUserId->isModified()) {
                 $affectedRows += $this->aUserRelatedByCreatedUserId->save($con);
             }
             $this->setUserRelatedByCreatedUserId($this->aUserRelatedByCreatedUserId);
         }
         if ($this->aUserRelatedByUpdatedUserId !== null) {
             if ($this->aUserRelatedByUpdatedUserId->isModified()) {
                 $affectedRows += $this->aUserRelatedByUpdatedUserId->save($con);
             }
             $this->setUserRelatedByUpdatedUserId($this->aUserRelatedByUpdatedUserId);
         }
         if ($this->aSchema !== null) {
             if ($this->aSchema->isModified()) {
                 $affectedRows += $this->aSchema->save($con);
             }
             $this->setSchema($this->aSchema);
         }
         if ($this->aSchemaPropertyRelatedByIsSubpropertyOf !== null) {
             if ($this->aSchemaPropertyRelatedByIsSubpropertyOf->isModified()) {
                 $affectedRows += $this->aSchemaPropertyRelatedByIsSubpropertyOf->save($con);
             }
             $this->setSchemaPropertyRelatedByIsSubpropertyOf($this->aSchemaPropertyRelatedByIsSubpropertyOf);
         }
         if ($this->aStatus !== null) {
             if ($this->aStatus->isModified()) {
                 $affectedRows += $this->aStatus->save($con);
             }
             $this->setStatus($this->aStatus);
         }
         // If this object has been modified, then save it to the database.
         if ($this->isModified()) {
             if ($this->isNew()) {
                 $pk = SchemaPropertyPeer::doInsert($this, $con);
                 $affectedRows += 1;
                 // we are assuming that there is only 1 row per doInsert() which
                 // should always be true here (even though technically
                 // BasePeer::doInsert() can insert multiple rows).
                 $this->setId($pk);
                 //[IMV] update autoincrement primary key
                 $this->setNew(false);
             } else {
                 $affectedRows += SchemaPropertyPeer::doUpdate($this, $con);
             }
             $this->resetModified();
             // [HL] After being saved an object is no longer 'modified'
         }
         if ($this->collDiscusss !== null) {
             foreach ($this->collDiscusss as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSchemaPropertysRelatedByIsSubpropertyOf !== null) {
             foreach ($this->collSchemaPropertysRelatedByIsSubpropertyOf as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSchemaPropertyElementsRelatedBySchemaPropertyId !== null) {
             foreach ($this->collSchemaPropertyElementsRelatedBySchemaPropertyId as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSchemaPropertyElementsRelatedByRelatedSchemaPropertyId !== null) {
             foreach ($this->collSchemaPropertyElementsRelatedByRelatedSchemaPropertyId as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
                 }
             }
         }
         if ($this->collSchemaPropertyElementHistorysRelatedBySchemaPropertyId !== null) {
             foreach ($this->collSchemaPropertyElementHistorysRelatedBySchemaPropertyId as $referrerFK) {
                 if (!$referrerFK->isDeleted()) {
                     $affectedRows += $referrerFK->save($con);
//.........这里部分代码省略.........
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:101,代码来源:BaseSchemaProperty.php


注:本文中的Schema::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。