本文整理汇总了PHP中fORM::mapClassToTable方法的典型用法代码示例。如果您正苦于以下问题:PHP fORM::mapClassToTable方法的具体用法?PHP fORM::mapClassToTable怎么用?PHP fORM::mapClassToTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fORM
的用法示例。
在下文中一共展示了fORM::mapClassToTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
if (defined('SKIPPING')) {
return;
}
$db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
if (DB_TYPE == 'sqlite') {
$db->execute(file_get_contents(DB_SETUP_FILE));
$db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
}
$db->execute(file_get_contents(DB_POPULATE_FILE));
$db->execute(file_get_contents(DB_EXTENDED_POPULATE_FILE));
self::$db = $db;
self::$schema = new fSchema($db);
fORMDatabase::attach(self::$db);
fORMSchema::attach(self::$schema);
fORMOrdering::configureOrderingColumn('TopAlbum', 'position');
fORMOrdering::configureOrderingColumn('FavoriteAlbum', 'position');
fORMOrdering::configureOrderingColumn('YearFavoriteAlbum', 'position');
if (defined('MAP_TABLES')) {
fORM::mapClassToTable('User', 'user');
fORM::mapClassToTable('Group', 'group');
fORM::mapClassToTable('Artist', 'popular_artists');
fORM::mapClassToTable('Album', 'records');
}
}
示例2: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
if (defined('MAP_TABLES')) {
fORM::mapClassToTable('User', 'user');
fORM::mapClassToTable('Group', 'group');
fORM::mapClassToTable('Artist', 'popular_artists');
fORM::mapClassToTable('Album', 'records');
}
}
示例3: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
fORMDatabase::attach(self::$db);
fORMSchema::attach(self::$schema);
if (defined('MAP_TABLES')) {
fORM::mapClassToTable('User', 'user');
fORM::mapClassToTable('Group', 'group');
fORM::mapClassToTable('Artist', 'popular_artists');
fORM::mapClassToTable('Album', 'records');
}
}
示例4: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
fORMDatabase::attach(self::$db);
fORMDatabase::attach(self::$db2, 'db2');
fORMSchema::attach(self::$schema);
fORMSchema::attach(self::$schema2, 'db2');
fORM::mapClassToTable('Db2User', 'users');
fORM::mapClassToDatabase('Db2User', 'db2');
fORM::mapClassToTable('Db2Group', 'groups');
fORM::mapClassToDatabase('Db2Group', 'db2');
}
示例5: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
fORMDatabase::attach($this->sharedFixture['db']);
fORMDatabase::attach($this->sharedFixture['db2'], 'db2');
fORMSchema::attach($this->sharedFixture['schema']);
fORMSchema::attach($this->sharedFixture['schema2'], 'db2');
fORM::mapClassToTable('Db2User', 'users');
fORM::mapClassToDatabase('Db2User', 'db2');
fORM::mapClassToTable('Db2Group', 'groups');
fORM::mapClassToDatabase('Db2Group', 'db2');
}
示例6: testCustomClassTableMapping
public function testCustomClassTableMapping()
{
$this->assertEquals('users', fORM::tablize('User'));
$this->assertEquals('User', fORM::classize('users'));
fORM::mapClassToTable('User', 'person');
$this->assertEquals('person', fORM::tablize('User'));
$this->assertEquals('User', fORM::classize('person'));
$this->assertNotEquals('users', fORM::tablize('User'));
$this->assertEquals('bicycles', fORM::tablize('Bicycle'));
$this->assertEquals('Bicycle', fORM::classize('bicycles'));
fORM::mapClassToTable('Bicycle', 'bike');
$this->assertEquals('bike', fORM::tablize('Bicycle'));
$this->assertEquals('Bicycle', fORM::classize('bike'));
$this->assertNotEquals('bicycles', fORM::tablize('Bicycle'));
}
示例7: setUp
protected function setUp()
{
if (defined('SKIPPING')) {
return;
}
$db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
$db->execute(file_get_contents(DB_SETUP_FILE));
$db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
$db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_SETUP_FILE)));
$db->clearCache();
fORMDatabase::attach($db);
$this->sharedFixture = $db;
fORM::mapClassToTable('Flourish2User', fix_schema('flourish2.users'));
fORM::mapClassToTable('Flourish2Group', fix_schema('flourish2.groups'));
fORM::mapClassToTable('Flourish2Artist', fix_schema('flourish2.artists'));
fORM::mapClassToTable('Flourish2Album', fix_schema('flourish2.albums'));
}
示例8: setUp
protected function setUp()
{
if (defined('SKIPPING')) {
return;
}
$db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
$db->execute(file_get_contents(DB_SETUP_FILE));
$db2 = new fDatabase(DB_TYPE, DB_2, DB_2_USERNAME, DB_2_PASSWORD, DB_2_HOST, DB_2_PORT);
$db2->execute(file_get_contents(DB_2_SETUP_FILE));
$this->sharedFixture = array($db, $db2);
fORMDatabase::attach($db);
fORMDatabase::attach($db2, 'db2');
fORM::mapClassToTable('Db2User', 'users');
fORM::mapClassToDatabase('Db2User', 'db2');
fORM::mapClassToTable('Db2Group', 'groups');
fORM::mapClassToDatabase('Db2Group', 'db2');
}
示例9: setUpBeforeClass
public static function setUpBeforeClass()
{
if (defined('SKIPPING')) {
return;
}
$db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
$db->execute(file_get_contents(DB_SETUP_FILE));
$db2 = new fDatabase(DB_TYPE, DB_2, DB_2_USERNAME, DB_2_PASSWORD, DB_2_HOST, DB_2_PORT);
$db2->execute(file_get_contents(DB_2_SETUP_FILE));
self::$db = $db;
self::$db2 = $db2;
fORMDatabase::attach($db);
fORMDatabase::attach($db2, 'db2');
fORM::mapClassToTable('Db2User', 'users');
fORM::mapClassToDatabase('Db2User', 'db2');
fORM::mapClassToTable('Db2Group', 'groups');
fORM::mapClassToDatabase('Db2Group', 'db2');
}
示例10: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
$db = $this->sharedFixture['db'];
$db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
$db->clearCache();
fORMDatabase::attach($db);
fORMSchema::attach($this->sharedFixture['schema']);
fORMOrdering::configureOrderingColumn('TopAlbum', 'position');
fORMOrdering::configureOrderingColumn('FavoriteAlbum', 'position');
fORMOrdering::configureOrderingColumn('YearFavoriteAlbum', 'position');
if (defined('MAP_TABLES')) {
fORM::mapClassToTable('User', 'user');
fORM::mapClassToTable('Group', 'group');
fORM::mapClassToTable('Artist', 'popular_artists');
fORM::mapClassToTable('Album', 'records');
}
}
示例11: setUpBeforeClass
public static function setUpBeforeClass()
{
if (defined('SKIPPING')) {
return;
}
$db = new fDatabase(DB_TYPE, DB, DB_USERNAME, DB_PASSWORD, DB_HOST, DB_PORT);
if (DB_TYPE == 'sqlite') {
$db->execute(file_get_contents(DB_SETUP_FILE));
$db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
$db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_SETUP_FILE)));
}
$db->execute(file_get_contents(DB_POPULATE_FILE));
$db->execute(file_get_contents(DB_EXTENDED_POPULATE_FILE));
$db->execute(fix_schema(file_get_contents(DB_ALTERNATE_SCHEMA_POPULATE_FILE)));
$db->clearCache();
fORMDatabase::attach($db);
self::$db = $db;
fORM::mapClassToTable('Flourish2User', fix_schema('flourish2.users'));
fORM::mapClassToTable('Flourish2Group', fix_schema('flourish2.groups'));
fORM::mapClassToTable('Flourish2Artist', fix_schema('flourish2.artists'));
fORM::mapClassToTable('Flourish2Album', fix_schema('flourish2.albums'));
}
示例12: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
fORMDatabase::attach($this->sharedFixture['db']);
fORMSchema::attach($this->sharedFixture['schema']);
if (defined('MAP_TABLES')) {
fORM::mapClassToTable('User', 'user');
fORM::mapClassToTable('Group', 'group');
fORM::mapClassToTable('Artist', 'popular_artists');
fORM::mapClassToTable('Album', 'records');
}
fORM::registerActiveRecordMethod('User', 'hasChanged', 'changed');
}
示例13: 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;
}
示例14: getByID
public static function getByID($id)
{
return fRecordSet::build('EventTime', array('pkid=' => $id));
}
public static function getRangeVisible($firstDay, $lastDay)
{
return fRecordSet::build('EventTime', array('eventdate>=' => $firstDay, 'eventdate<=' => $lastDay, 'calevent{id}.hidden!' => 1, 'eventstatus!' => 'S'), array('eventdate' => 'asc'));
}
private function getEvent()
{
if ($this->getEventstatus() === 'E') {
return $this->createEvent('exceptionid');
}
return $this->createEvent('id');
}
public function getFormattedDate()
{
return $this->getEventdate()->format('Y-m-d');
}
public function toEventSummaryArray()
{
$eventArray = $this->getEvent()->toArray();
$eventArray['date'] = $this->getFormattedDate();
$eventArray['caldaily_id'] = $this->getPkid();
$eventArray['cancelled'] = $this->getEventstatus() == 'C';
$eventArray['newsflash'] = $this->getNewsflash();
return $eventArray;
}
}
fORM::mapClassToTable('EventTime', 'caldaily');
示例15: setUp
public function setUp()
{
if (defined('SKIPPING')) {
$this->markTestSkipped();
}
fORMDatabase::attach($this->sharedFixture['db']);
fORMSchema::attach($this->sharedFixture['schema']);
fORM::mapClassToTable('Flourish2User', fix_schema('flourish2.users'));
fORM::mapClassToTable('Flourish2Group', fix_schema('flourish2.groups'));
fORM::mapClassToTable('Flourish2Artist', fix_schema('flourish2.artists'));
fORM::mapClassToTable('Flourish2Album', fix_schema('flourish2.albums'));
}