当前位置: 首页>>代码示例>>PHP>>正文


PHP RedBeanDatabase::isFrozen方法代码示例

本文整理汇总了PHP中RedBeanDatabase::isFrozen方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanDatabase::isFrozen方法的具体用法?PHP RedBeanDatabase::isFrozen怎么用?PHP RedBeanDatabase::isFrozen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RedBeanDatabase的用法示例。


在下文中一共展示了RedBeanDatabase::isFrozen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSavingTwiceWithAModelThatHasACurrencyValueAsARelation

 public function testSavingTwiceWithAModelThatHasACurrencyValueAsARelation()
 {
     if (!RedBeanDatabase::isFrozen()) {
         Yii::app()->user->userModel = User::getByUsername('super');
         $testItem = new OwnedSecurableTestItem();
         $testItem->member = 'test';
         $saved = $testItem->save();
         $this->assertTrue($saved);
         //Because OwnedSecurableTestItem as a relatedCurrency, there are some strange issues with saving again.
         //It creates currency validation issues for any of the related users like owner, modifiedUser etc.
         //Need to investigate further to fix.
         //$testItem->forget();
         //$testItem = OwnedSecurableTestItem::getById($testItem->id);
         //Save again immediately after.
         $validated = $testItem->validate();
         // echo "<pre>";
         // print_r($testItem->getErrors());
         // echo "</pre>";
         $this->assertTrue($validated);
         $saved = $testItem->save();
         $this->assertTrue($saved);
         //Reset count of test items to 0.
         $testItem->delete();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:OwnedSecurableTestItemTest.php

示例2: onEvent

 public function onEvent($type, $info)
 {
     assert('$type == "after_update"');
     if (RedBeanDatabase::isFrozen()) {
         return;
     }
     $hints = $info->getMeta("hint");
     if ($hints !== null) {
         assert('is_array($hints)');
         foreach ($hints as $key => $value) {
             switch ($value) {
                 case 'date':
                     $this->dateOptimizer->setTable($info->getMeta("type"));
                     $this->dateOptimizer->setColumn($key);
                     $this->dateOptimizer->setValue($info->{$key});
                     $this->dateOptimizer->optimize();
                     break;
                 case 'datetime':
                     $this->datetimeOptimizer->setTable($info->getMeta("type"));
                     $this->datetimeOptimizer->setColumn($key);
                     $this->datetimeOptimizer->setValue($info->{$key});
                     $this->datetimeOptimizer->optimize();
                     break;
                 case 'id':
                     $this->idOptimizer->setTable($info->getMeta("type"));
                     $this->idOptimizer->setColumn($key);
                     $this->idOptimizer->setValue($info->{$key});
                     $this->idOptimizer->optimize();
                     break;
             }
         }
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:33,代码来源:RedBeanAfterUpdateHintManager.php

示例3: testSaveModelFromPostSuccessfulSave

 public function testSaveModelFromPostSuccessfulSave()
 {
     //Unfreeze since the test model is not part of the standard schema.
     $freezeWhenComplete = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     Yii::app()->user->userModel = User::getByUsername('super');
     $savedSuccessfully = false;
     $modelToStringValue = null;
     $postData = array('member' => 'abc');
     $model = new OwnedSecurableTestItem();
     $this->assertFalse($model->hasErrors());
     $controllerUtil = new ZurmoControllerUtil();
     $model = $controllerUtil->saveModelFromPost($postData, $model, $savedSuccessfully, $modelToStringValue);
     $this->assertTrue($savedSuccessfully);
     $this->assertEquals('abc', $modelToStringValue);
     $this->assertFalse($model->hasErrors());
     $this->assertTrue($model->id > 0);
     //Re-freeze if needed.
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:25,代码来源:ZurmoControllerUtilTest.php

示例4: setup

 public function setup()
 {
     parent::setUp();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientFormTest.php

示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     if (!RedBeanDatabase::isFrozen()) {
         // TODO: @Shoaibi: High: get rid of this for God's sake.
         $campaignItem = CampaignItemTestHelper::createCampaignItem(0);
         $campaignItem->delete();
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:10,代码来源:CampaignItemsUtilTest.php

示例6: setUp

 public function setUp()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:MatrixReportDataProviderTest.php

示例7: setup

 public function setup()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     DisplayAttributeForReportForm::resetCount();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:ReportResultsRowDataTest.php

示例8: onEvent

 public function onEvent($type, $info)
 {
     assert('$type == "sql_exec"');
     if (!RedBeanDatabase::isFrozen()) {
         return;
     }
     //echo "<pre>";
     //print_r($info->getSQL());
     //echo "</pre>";
     //now we can count total queries, how many time the same query is run,
     //if we want to do db timings we would need to do this from a different listener. (actually not sure how this will work...)
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:12,代码来源:RedBeanSqlExecuteManager.php

示例9: setUp

 public function setUp()
 {
     parent::setUp();
     if (strlen(Yii::app()->params['testApiUrl']) > 0) {
         $this->serverUrl = Yii::app()->params['testApiUrl'];
     }
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:ApiBaseTest.php

示例10: tearDownAfterClass

 public static function tearDownAfterClass()
 {
     if (RedBeanDatabase::isFrozen()) {
         TestDatabaseUtil::deleteRowsFromAllTablesExceptLog();
     } else {
         TestDatabaseUtil::deleteAllTablesExceptLog();
     }
     RedBeanModel::forgetAll();
     RedBeanDatabase::close();
     assert('!RedBeanDatabase::isSetup()');
     // Not Coding Standard
     GeneralCache::forgetAll();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:13,代码来源:BaseTest.php

示例11: setup

 public function setup()
 {
     parent::setUp();
     Yii::app()->user->userModel = User::getByUsername('super');
     DisplayAttributeForReportForm::resetCount();
     ModelRelationsAndAttributesToSummableReportAdapter::forgetAll();
     ModelRelationsAndAttributesToRowsAndColumnsReportAdapter::forgetAll();
     ModelRelationsAndAttributesToMatrixReportAdapter::forgetAll();
     $freeze = false;
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freeze = true;
     }
     $this->freeze = $freeze;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:15,代码来源:CalculatedNumberForReportListViewColumnAdapterTest.php

示例12: testResolveModelsHasManyFilesFromPost

 public function testResolveModelsHasManyFilesFromPost()
 {
     if (!RedBeanDatabase::isFrozen()) {
         Yii::app()->user->userModel = User::getByUsername('super');
         $fileCount = count(FileModel::getAll());
         $this->assertEquals(0, $fileCount);
         $file1 = ZurmoTestHelper::createFileModel();
         $file2 = ZurmoTestHelper::createFileModel();
         $file3 = ZurmoTestHelper::createFileModel();
         $model = new ModelWithAttachmentTestItem();
         $_POST['myTest'] = array($file1->id, $file2->id, $file3->id);
         FileModelUtil::resolveModelsHasManyFilesFromPost($model, 'files', 'myTest');
         $model->member = 'test';
         $saved = $model->save();
         $this->assertTrue($saved);
         $fileCount = count(FileModel::getAll());
         $this->assertEquals(3, $fileCount);
         $modelId = $model->id;
         $model->forget();
         $model = ModelWithAttachmentTestItem::getById($modelId);
         $this->assertEquals(3, $model->files->count());
         //Add a fourth file.
         $file4 = ZurmoTestHelper::createFileModel();
         $_POST['myTest'] = array($file1->id, $file2->id, $file3->id, $file4->id);
         FileModelUtil::resolveModelsHasManyFilesFromPost($model, 'files', 'myTest');
         $saved = $model->save();
         $this->assertTrue($saved);
         $fileCount = count(FileModel::getAll());
         $this->assertEquals(4, $fileCount);
         $model->forget();
         $model = ModelWithAttachmentTestItem::getById($modelId);
         $this->assertEquals(4, $model->files->count());
         //Remove the 2nd file.
         $_POST['myTest'] = array($file1->id, $file3->id, $file4->id);
         FileModelUtil::resolveModelsHasManyFilesFromPost($model, 'files', 'myTest');
         $saved = $model->save();
         $this->assertTrue($saved);
         $fileCount = count(FileModel::getAll());
         $this->assertEquals(3, $fileCount);
         $model->forget();
         $model = ModelWithAttachmentTestItem::getById($modelId);
         $this->assertEquals(3, $model->files->count());
         $compareIds = array($file1->id, $file3->id, $file4->id);
         foreach ($model->files as $fileModel) {
             $this->assertTrue(in_array($fileModel->id, $compareIds));
         }
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:48,代码来源:FileModelUtilTest.php

示例13: onEvent

 public function onEvent($type, $info)
 {
     assert('$type == "update"');
     if (RedBeanDatabase::isFrozen()) {
         return;
     }
     $hints = $info->getMeta("hint");
     if ($hints !== null) {
         assert('is_array($hints)');
         foreach ($hints as $key => $value) {
             if (in_array($value, array('blob', 'longblob', 'boolean', 'date', 'datetime', 'string', 'text', 'longtext', 'id'))) {
                 RedBeanColumnTypeOptimizer::optimize($info->getMeta("type"), $key, $value);
             }
         }
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:16,代码来源:RedBeanBeforeUpdateHintManager.php

示例14: testSequentialProcessViewFactory

 public function testSequentialProcessViewFactory()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $freezeWhenComplete = false;
     //Unfreeze since the test model is not part of the standard schema.
     if (RedBeanDatabase::isFrozen()) {
         RedBeanDatabase::unfreeze();
         $freezeWhenComplete = true;
     }
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(0, count($testModels));
     $import = new Import();
     $mappingData = array('column_0' => array('attributeIndexOrDerivedType' => 'string', 'type' => 'importColumn', 'mappingRulesData' => array('DefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))), 'column_23' => array('attributeIndexOrDerivedType' => 'FullName', 'type' => 'importColumn', 'mappingRulesData' => array('FullNameDefaultValueModelAttributeMappingRuleForm' => array('defaultValue' => null))));
     $serializedData['importRulesType'] = 'ImportModelTestItem';
     $serializedData['mappingData'] = $mappingData;
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importAnalyzerTest.csv', $import->getTempTableName());
     $config = array('pagination' => array('pageSize' => 2));
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $sequentialProcess = new ImportCreateUpdateModelsSequentialProcess($import, $dataProvider);
     $sequentialProcess->run(null, null);
     $route = 'default/someAction';
     $view = SequentialProcessViewFactory::makeBySequentialProcess($sequentialProcess, $route);
     $content = $view->render();
     $this->assertNotNull($content);
     $this->assertEquals('SequentialProcessView', get_class($view));
     $this->assertEquals('processRows', $sequentialProcess->getNextStep());
     //Now process the first run. Will process page 0.
     $sequentialProcess = new ImportCreateUpdateModelsSequentialProcess($import, $dataProvider);
     $sequentialProcess->run('processRows', null);
     $route = 'default/someAction';
     $view = SequentialProcessViewFactory::makeBySequentialProcess($sequentialProcess, $route);
     $content = $view->render();
     $this->assertNotNull($content);
     $this->assertEquals('SequentialProcessView', get_class($view));
     $this->assertEquals(array('page' => 1), $sequentialProcess->getNextParams());
     //Confirm 2 models were successfully added.
     $testModels = ImportModelTestItem::getAll();
     $this->assertEquals(2, count($testModels));
     //Re-freeze if needed.
     if ($freezeWhenComplete) {
         RedBeanDatabase::freeze();
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:46,代码来源:ImportCreateUpdateModelsSequentialProcessTest.php

示例15: testASingleAttributeThatRunsFrozenQueryCorrectly

 /**
  * Make sure the query actually runs correctly.
  */
 public function testASingleAttributeThatRunsFrozenQueryCorrectly()
 {
     if (RedBeanDatabase::isFrozen()) {
         $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('Account'), 'id');
         $sql = SQLQueryUtil::makeQuery(Account::getTableName('Account'), $selectQueryAdapter, $joinTablesAdapter, null, null, $content, null, null);
         $rows = R::getAll($sql);
         $this->assertEquals(0, count($rows));
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:23,代码来源:ReadOptimizationFiltersReportQueryBuilderTest.php


注:本文中的RedBeanDatabase::isFrozen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。