當前位置: 首頁>>代碼示例>>PHP>>正文


PHP fGrammar::addSingularPluralRule方法代碼示例

本文整理匯總了PHP中fGrammar::addSingularPluralRule方法的典型用法代碼示例。如果您正苦於以下問題:PHP fGrammar::addSingularPluralRule方法的具體用法?PHP fGrammar::addSingularPluralRule怎麽用?PHP fGrammar::addSingularPluralRule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在fGrammar的用法示例。


在下文中一共展示了fGrammar::addSingularPluralRule方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setupORM

 protected function setupORM()
 {
     if ($this->isOrmSettedUp) {
         return;
     }
     $this->defineConstants();
     // Extract port from host. See wpdb::db_connect
     $port = null;
     $host = $this->wp->getDbHost();
     if (preg_match('/^(.+):(\\d+)$/', trim($host), $m)) {
         $host = $m[1];
         $port = $m[2];
     }
     $database = new fDatabase('mysql', $this->wp->getDbName(), $this->wp->getDbUser(), $this->wp->getDbPassword(), $host, $port);
     // $database->enableDebugging(true);
     fORMDatabase::attach($database);
     fORM::mapClassToTable('WpTesting_Model_Test', WP_DB_PREFIX . 'posts');
     fORM::mapClassToTable('WpTesting_Model_Question', WPT_DB_PREFIX . 'questions');
     fORM::mapClassToTable('WpTesting_Model_Taxonomy', WP_DB_PREFIX . 'term_taxonomy');
     fORM::mapClassToTable('WpTesting_Model_GlobalAnswer', WP_DB_PREFIX . 'terms');
     fORM::mapClassToTable('WpTesting_Model_Answer', WPT_DB_PREFIX . 'answers');
     fORM::mapClassToTable('WpTesting_Model_Scale', WP_DB_PREFIX . 'terms');
     fORM::mapClassToTable('WpTesting_Model_Score', WPT_DB_PREFIX . 'scores');
     fORM::mapClassToTable('WpTesting_Model_Passing', WPT_DB_PREFIX . 'passings');
     fORM::mapClassToTable('WpTesting_Model_Result', WP_DB_PREFIX . 'terms');
     fORM::mapClassToTable('WpTesting_Model_Formula', WPT_DB_PREFIX . 'formulas');
     fORM::mapClassToTable('WpTesting_Model_Respondent', WP_DB_PREFIX . 'users');
     fGrammar::addSingularPluralRule('Taxonomy', 'Taxonomy');
     fGrammar::addSingularPluralRule('Score', 'Score');
     fGrammar::addSingularPluralRule('Answer', 'Answer');
     $schema = fORMSchema::retrieve('name:default');
     $fkOptions = array('on_delete' => 'cascade', 'on_update' => 'cascade');
     $schema->setKeysOverride(array(array('column' => 'test_id', 'foreign_table' => WP_DB_PREFIX . 'posts', 'foreign_column' => 'ID') + $fkOptions), WPT_DB_PREFIX . 'questions', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'answer_id', 'foreign_table' => WPT_DB_PREFIX . 'answers', 'foreign_column' => 'answer_id') + $fkOptions, array('column' => 'scale_id', 'foreign_table' => WP_DB_PREFIX . 'terms', 'foreign_column' => 'term_id') + $fkOptions), WPT_DB_PREFIX . 'scores', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'test_id', 'foreign_table' => WP_DB_PREFIX . 'posts', 'foreign_column' => 'ID') + $fkOptions, array('column' => 'respondent_id', 'foreign_table' => WP_DB_PREFIX . 'users', 'foreign_column' => 'ID') + $fkOptions), WPT_DB_PREFIX . 'passings', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'answer_id', 'foreign_table' => WPT_DB_PREFIX . 'answers', 'foreign_column' => 'answer_id') + $fkOptions, array('column' => 'passing_id', 'foreign_table' => WPT_DB_PREFIX . 'passings', 'foreign_column' => 'passing_id') + $fkOptions), WPT_DB_PREFIX . 'passing_answers', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'test_id', 'foreign_table' => WP_DB_PREFIX . 'posts', 'foreign_column' => 'ID') + $fkOptions, array('column' => 'result_id', 'foreign_table' => WP_DB_PREFIX . 'terms', 'foreign_column' => 'term_id') + $fkOptions), WPT_DB_PREFIX . 'formulas', 'foreign');
     $schema->setColumnInfoOverride(null, WP_DB_PREFIX . 'term_relationships', 'term_order');
     $schema->setKeysOverride(array(array('column' => 'object_id', 'foreign_table' => WP_DB_PREFIX . 'posts', 'foreign_column' => 'ID') + $fkOptions, array('column' => 'term_taxonomy_id', 'foreign_table' => WP_DB_PREFIX . 'term_taxonomy', 'foreign_column' => 'term_taxonomy_id') + $fkOptions), WP_DB_PREFIX . 'term_relationships', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'term_id', 'foreign_table' => WP_DB_PREFIX . 'terms', 'foreign_column' => 'term_id') + $fkOptions), WP_DB_PREFIX . 'term_taxonomy', 'foreign');
     $schema->setKeysOverride(array(array('column' => 'question_id', 'foreign_table' => WPT_DB_PREFIX . 'questions', 'foreign_column' => 'question_id') + $fkOptions, array('column' => 'global_answer_id', 'foreign_table' => WP_DB_PREFIX . 'terms', 'foreign_column' => 'term_id') + $fkOptions), WPT_DB_PREFIX . 'answers', 'foreign');
     $schema->setKeysOverride(array(), WPT_DB_PREFIX . 'sections', 'foreign');
     $schema->setKeysOverride(array(), WPT_DB_PREFIX . 'fields', 'foreign');
     $schema->setKeysOverride(array(), WPT_DB_PREFIX . 'field_values', 'foreign');
     $this->wp->doAction('wp_testing_orm_setup', $schema, $database);
     $this->isOrmSettedUp = true;
 }
開發者ID:pmanterys,項目名稱:wp-mw-newsletter,代碼行數:47,代碼來源:Facade.php


注:本文中的fGrammar::addSingularPluralRule方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。