本文整理汇总了PHP中fORMDatabase::attach方法的典型用法代码示例。如果您正苦于以下问题:PHP fORMDatabase::attach方法的具体用法?PHP fORMDatabase::attach怎么用?PHP fORMDatabase::attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fORMDatabase
的用法示例。
在下文中一共展示了fORMDatabase::attach方法的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
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));
fORMDatabase::attach($db);
$this->sharedFixture = $db;
}
示例3: 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));
$db->execute(file_get_contents(DB_EXTENDED_SETUP_FILE));
fORMDatabase::attach($db);
self::$db = $db;
}
示例4: 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');
}
}
示例5: 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');
}
示例6: 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');
}
示例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: fTemplating
//Set the Template root, and set the header and footer
$tmpl = new fTemplating($root_path . '/views/');
$tmpl->enableMinification('development', dirname(__FILE__) . '/../js_cache/',dirname(__FILE__) . '/..');
$tmpl->add('css','/bootstrap/bootstrap.min.css');
$tmpl->add('css','/assets/css/jquery-ui.css');
$tmpl->add('js','/assets/js/jquery.min.js');
$tmpl->add('js','/assets/js/jquery-ui.min.js');
$tmpl->add('js','/assets/js/jquery.collapsible.js');
$tmpl->add('js','/assets/js/jquery.graphite.js');
$tmpl->add('js','/bootstrap/js/bootstrap-modal.js');
$tmpl->add('js','/bootstrap/js/bootstrap-twipsy.js');
$tmpl->add('js','/bootstrap/js/bootstrap-popover.js');
$tmpl->set('header', 'header.php');
$tmpl->set('footer', 'footer.php');
//Set DB connection (using flourish it isn't actually connected to until the first use)
$mysql_db = new fDatabase('mysql', $database_name, $database_user, $database_password);
//Connect the db to the ORM functions
fORMDatabase::attach($mysql_db);
//Start the Flourish Session
fSession::open();
示例13: 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'));
}
示例14: fDatabase
<?php
require_once __DIR__ . '/../settings.php';
require_once __DIR__ . '/../app/vendor/flourish.php';
require_once __DIR__ . '/../app/vendor/markdown.php';
require_once __DIR__ . '/../cache-settings.php';
fORMDatabase::attach(new fDatabase(DB_TYPE, DB_NAME, DB_USER, DB_PASS, DB_HOST));
if (ENABLE_SCHEMA_CACHING) {
fORM::enableSchemaCaching($cache);
}
require_once __DIR__ . '/../app/models/Permission.php';
require_once __DIR__ . '/../app/models/Problem.php';
require_once __DIR__ . '/../app/models/Profile.php';
require_once __DIR__ . '/../app/models/Question.php';
require_once __DIR__ . '/../app/models/Record.php';
require_once __DIR__ . '/../app/models/Registration.php';
require_once __DIR__ . '/../app/models/Report.php';
require_once __DIR__ . '/../app/models/User.php';
require_once __DIR__ . '/../app/models/UserEmail.php';
require_once __DIR__ . '/../app/models/UserStat.php';
require_once __DIR__ . '/../app/models/Variable.php';
require_once __DIR__ . '/../app/models/Vericode.php';
require_once __DIR__ . '/../app/helpers/Util.php';
function script_error($message)
{
trigger_error($message);
exit;
}
function prompt_silent($prompt)
{
$command = "/usr/bin/env bash -c 'echo OK'";
示例15: 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;
}