本文整理汇总了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;
}