本文整理汇总了PHP中Account::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::getTableName方法的具体用法?PHP Account::getTableName怎么用?PHP Account::getTableName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::getTableName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
$accountTableName = Account::getTableName();
$contactTableName = Contact::getTableName();
$opportunityTableName = Opportunity::getTableName();
ExternalSystemIdUtil::addExternalIdColumnIfMissing($accountTableName);
ExternalSystemIdUtil::addExternalIdColumnIfMissing($contactTableName);
ExternalSystemIdUtil::addExternalIdColumnIfMissing($opportunityTableName);
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
$accountTableName = Account::getTableName('Account');
$contactTableName = Contact::getTableName('Contact');
$opportunityTableName = Opportunity::getTableName('Opportunity');
$columnName = ExternalSystemIdUtil::EXTERNAL_SYSTEM_ID_COLUMN_NAME;
RedBeanColumnTypeOptimizer::externalIdColumn($accountTableName, $columnName);
RedBeanColumnTypeOptimizer::externalIdColumn($contactTableName, $columnName);
RedBeanColumnTypeOptimizer::externalIdColumn($opportunityTableName, $columnName);
}
示例3: testImportDataAnalysisResults
public function testImportDataAnalysisResults()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$import = new Import();
$serializedData['importRulesType'] = 'Tasks';
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
$accountTableName = Account::getTableName('Account');
$contactTableName = Contact::getTableName('Contact');
$opportunityTableName = Opportunity::getTableName('Opportunity');
$account1 = AccountTestHelper::createAccountByNameForOwner('account1', $super);
$account2 = AccountTestHelper::createAccountByNameForOwner('account2', $super);
$account3 = AccountTestHelper::createAccountByNameForOwner('account3', $super);
$contact1 = ContactTestHelper::createContactByNameForOwner('contact1', $super);
$contact2 = ContactTestHelper::createContactByNameForOwner('contact2', $super);
$contact3 = ContactTestHelper::createContactByNameForOwner('contact3', $super);
$opportunity1 = OpportunityTestHelper::createOpportunityByNameForOwner('opportunity1', $super);
$opportunity2 = OpportunityTestHelper::createOpportunityByNameForOwner('opportunity2', $super);
$opportunity3 = OpportunityTestHelper::createOpportunityByNameForOwner('opportunity3', $super);
//Make models externally linked for testing.
ImportTestHelper::updateModelsExternalId($account2, 'ACC');
ImportTestHelper::updateModelsExternalId($contact2, 'CON');
ImportTestHelper::updateModelsExternalId($opportunity2, 'OPP');
ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.tasks.tests.unit.files'));
R::exec("update " . $import->getTempTableName() . " set column_0 = " . $account3->id . " where id != 1 limit 3");
R::exec("update " . $import->getTempTableName() . " set column_2 = " . $contact3->id . " where id != 1 limit 4");
R::exec("update " . $import->getTempTableName() . " set column_4 = " . $opportunity3->id . " where id != 1 limit 5");
$mappingData = array('column_0' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived', IdValueTypeMappingRuleForm::ZURMO_MODEL_ID), 'column_1' => ImportMappingUtil::makeModelDerivedColumnMappingData('AccountDerived'), 'column_2' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived', IdValueTypeMappingRuleForm::ZURMO_MODEL_ID), 'column_3' => ImportMappingUtil::makeModelDerivedColumnMappingData('ContactDerived'), 'column_4' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived', IdValueTypeMappingRuleForm::ZURMO_MODEL_ID), 'column_5' => ImportMappingUtil::makeModelDerivedColumnMappingData('OpportunityDerived'));
$serializedData = unserialize($import->serializedData);
$serializedData['mappingData'] = $mappingData;
$import->serializedData = serialize($serializedData);
$this->assertTrue($import->save());
$importRules = ImportRulesUtil::makeImportRulesByType('Tasks');
$config = array('pagination' => array('pageSize' => 2));
//This test csv has a header row.
$dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
//Run data analyzer
$importDataAnalyzer = new ImportDataAnalyzer($importRules, $dataProvider);
foreach ($mappingData as $columnName => $columnMappingData) {
$importDataAnalyzer->analyzeByColumnNameAndColumnMappingData($columnName, $columnMappingData);
}
$messagesData = $importDataAnalyzer->getMessagesData();
$compareData = array('column_0' => array(array('message' => '3 record(s) will be updated and 7 record(s) will be skipped during import.', 'sanitizerUtilType' => 'AccountDerivedIdValueType', 'moreAvailable' => false)), 'column_1' => array(array('message' => '3 record(s) will be updated and 7 record(s) will be skipped during import.', 'sanitizerUtilType' => 'AccountDerivedIdValueType', 'moreAvailable' => false)), 'column_2' => array(array('message' => '4 record(s) will be updated and 6 record(s) will be skipped during import.', 'sanitizerUtilType' => 'ContactDerivedIdValueType', 'moreAvailable' => false)), 'column_3' => array(array('message' => '3 record(s) will be updated and 7 record(s) will be skipped during import.', 'sanitizerUtilType' => 'ContactDerivedIdValueType', 'moreAvailable' => false)), 'column_4' => array(array('message' => '5 record(s) will be updated and 5 record(s) will be skipped during import.', 'sanitizerUtilType' => 'OpportunityDerivedIdValueType', 'moreAvailable' => false)), 'column_5' => array(array('message' => '3 record(s) will be updated and 7 record(s) will be skipped during import.', 'sanitizerUtilType' => 'OpportunityDerivedIdValueType', 'moreAvailable' => false)));
$this->assertEquals($compareData, $messagesData);
$importInstructionsData = $importDataAnalyzer->getImportInstructionsData();
$compareInstructionsData = array();
$this->assertEquals($compareInstructionsData, $importInstructionsData);
}
示例4: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
ExternalSystemIdUtil::addExternalIdColumnIfMissing(Account::getTableName());
ExternalSystemIdUtil::addExternalIdColumnIfMissing(Contact::getTableName());
ExternalSystemIdUtil::addExternalIdColumnIfMissing(Opportunity::getTableName());
$account = AccountTestHelper::createAccountByNameForOwner('testAccount', $super);
ImportTestHelper::updateModelsExternalId($account, 'ACC');
$contact = ContactTestHelper::createContactByNameForOwner('testContact', $super);
ImportTestHelper::updateModelsExternalId($contact, 'CON');
$opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('testOpportunity', $super);
ImportTestHelper::updateModelsExternalId($opportunity, 'OPP');
}
示例5: testASingleAttributeThatRunsFrozenQueryCorrectly
/**
* Make sure the query actually runs correctly.
*/
public function testASingleAttributeThatRunsFrozenQueryCorrectly()
{
$q = DatabaseCompatibilityUtil::getQuote();
$joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('ReportModelTestItem');
$builder = new FiltersReportQueryBuilder($joinTablesAdapter, '1');
$filter = new FilterForReportForm('AccountsModule', 'Account', Report::TYPE_ROWS_AND_COLUMNS);
$filter->attributeIndexOrDerivedType = 'ReadOptimization';
$content = $builder->makeQueryContent(array($filter));
$compareContent = "({$q}ownedsecurableitem{$q}.{$q}securableitem_id{$q} = (select securableitem_id " . "from {$q}account_read{$q} where {$q}securableitem_id{$q} = {$q}ownedsecurableitem" . "{$q}.{$q}securableitem_id{$q} and {$q}munge_id{$q} in ('U" . self::$superUserId . "', 'G" . self::$everyoneGroupId . "') limit 1))";
$this->assertEquals($compareContent, $content);
$this->assertEquals(1, $joinTablesAdapter->getFromTableJoinCount());
$this->assertEquals(0, $joinTablesAdapter->getLeftTableJoinCount());
$selectQueryAdapter = new RedBeanModelSelectQueryAdapter();
$selectQueryAdapter->addClause(Account::getTableName(), 'id');
$sql = SQLQueryUtil::makeQuery(Account::getTableName(), $selectQueryAdapter, $joinTablesAdapter, null, null, $content, null, null);
$rows = ZurmoRedBean::getAll($sql);
$this->assertEquals(0, count($rows));
}
开发者ID:KulturedKitsch,项目名称:kulturedkitsch.info,代码行数:21,代码来源:ReadOptimizationFiltersReportQueryBuilderTest.php
示例6: testAutoBuildUpgrade
/**
* @depends testAutoBuildDatabase
*/
public function testAutoBuildUpgrade()
{
// adding Text Field
$metadata = Account::getMetadata();
$metadata['Account']['members'][] = 'newField';
$rules = array('newField', 'type', 'type' => 'string');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'string128';
$rules = array('string128', 'type', 'type' => 'string');
$metadata['Account']['rules'][] = $rules;
$rules = array('string128', 'length', 'min' => 1, 'max' => 128);
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'string555';
$rules = array('string555', 'type', 'type' => 'string');
$metadata['Account']['rules'][] = $rules;
$rules = array('string555', 'length', 'min' => 1, 'max' => 555);
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'string100000';
$rules = array('string100000', 'type', 'type' => 'string');
$metadata['Account']['rules'][] = $rules;
$rules = array('string100000', 'length', 'min' => 1, 'max' => 100000);
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'textField';
$rules = array('textField', 'type', 'type' => 'text');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'longTextField';
$rules = array('longTextField', 'type', 'type' => 'longtext');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'dateField';
$rules = array('dateField', 'type', 'type' => 'date');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'booleanField';
$rules = array('booleanField', 'boolean');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'integerField';
$rules = array('integerField', 'type', 'type' => 'integer');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'dateTimeField';
$rules = array('dateTimeField', 'type', 'type' => 'datetime');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'urlField';
$rules = array('urlField', 'url');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'floatField';
$rules = array('floatField', 'type', 'type' => 'float');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'blobField';
$rules = array('blobField', 'type', 'type' => 'blob');
$metadata['Account']['rules'][] = $rules;
$metadata['Account']['members'][] = 'longBlobField';
$rules = array('longBlobField', 'type', 'type' => 'longblob');
$metadata['Account']['rules'][] = $rules;
Account::setMetadata($metadata);
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$messageLogger = new MessageLogger();
$beforeRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
InstallUtil::autoBuildDatabase($messageLogger, true);
$afterRowCount = DatabaseCompatibilityUtil::getTableRowsCountTotal();
$this->assertEquals($beforeRowCount, $afterRowCount);
//Check Account fields
$tableName = Account::getTableName();
$columns = ZurmoRedBean::$writer->getColumns($tableName);
$unsigned = '';
if (!RedBeanModelMemberRulesToColumnAdapter::ASSUME_SIGNED) {
$unsigned = ' unsigned';
}
$this->assertEquals('text', $columns['newfield']);
$this->assertEquals('varchar(128)', $columns['string128']);
$this->assertEquals('text', $columns['string555']);
$this->assertEquals('longtext', $columns['string100000']);
$this->assertEquals('text', $columns['textfield']);
$this->assertEquals('date', $columns['datefield']);
$this->assertEquals('tinyint(1) unsigned', $columns['booleanfield']);
$this->assertEquals('int(11)' . $unsigned, $columns['integerfield']);
$this->assertEquals('datetime', $columns['datetimefield']);
$this->assertEquals('varchar(255)', $columns['urlfield']);
$this->assertEquals('double', $columns['floatfield']);
$this->assertEquals('longtext', $columns['longtextfield']);
$this->assertEquals('blob', $columns['blobfield']);
$this->assertEquals('longblob', $columns['longblobfield']);
$account = new Account();
$account->name = 'Test Name';
$account->owner = $super;
$randomString = str_repeat("Aa", 64);
$account->string128 = $randomString;
$this->assertTrue($account->save());
$metadata = Account::getMetadata();
foreach ($metadata['Account']['rules'] as $key => $rule) {
if ($rule[0] == 'string128' && $rule[1] == 'length') {
$metadata['Account']['rules'][$key]['max'] = 64;
}
}
Account::setMetadata($metadata);
InstallUtil::autoBuildDatabase($messageLogger, true);
RedBeanModel::forgetAll();
$modifiedAccount = Account::getById($account->id);
//.........这里部分代码省略.........