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


PHP ZurmoRedBean::getRow方法代码示例

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


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

示例1: testProperlyDeletingActivityItems

 public function testProperlyDeletingActivityItems()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $count = ZurmoRedBean::getRow('select count(*) count from activity_item');
     $this->assertEquals(0, $count['count']);
     $account = AccountTestHelper::createAccountByNameForOwner('anAccount', Yii::app()->user->userModel);
     $deleted = $account->delete();
     $this->assertTrue($deleted);
     $count = ZurmoRedBean::getRow('select count(*) count from activity_item');
     $this->assertEquals(0, $count['count']);
     $account2 = AccountTestHelper::createAccountByNameForOwner('anAccount2', Yii::app()->user->userModel);
     $opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('anOpp', Yii::app()->user->userModel);
     $task = TaskTestHelper::createTaskWithOwnerAndRelatedAccount('aTask', Yii::app()->user->userModel, $account2);
     $task->activityItems->add($opportunity);
     $this->assertTrue($task->save());
     $taskId = $task->id;
     $task->forget();
     RedBeansCache::forgetAll();
     $count = ZurmoRedBean::getRow('select count(*) count from activity_item');
     $this->assertEquals(2, $count['count']);
     $deleted = $account2->delete();
     $this->assertTrue($deleted);
     $account2->forget();
     $count = ZurmoRedBean::getRow('select count(*) count from activity_item');
     $this->assertEquals(1, $count['count']);
     RedBeansCache::forgetAll();
     //Make sure things render ok even with the account deleted.
     $content = ActivitiesUtil::renderSummaryContent(Task::getById($taskId), 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'HomeModule');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:29,代码来源:ActivitiesObserverTest.php

示例2: testSaveAllMetadata

 public function testSaveAllMetadata()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $this->assertTrue(ContactsModule::loadStartingData());
     $messageLogger = new MessageLogger();
     InstallUtil::autoBuildDatabase($messageLogger, true);
     chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands');
     $command = "php zurmocTest.php manageMetadata super saveAllMetadata";
     if (!IS_WINNT) {
         $command .= ' 2>&1';
     }
     exec($command, $output);
     // Check if data are saved for some specific View
     $moduleMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='NotesModule'");
     $this->assertTrue($moduleMetadata['id'] > 0);
     $this->assertTrue(strlen($moduleMetadata['serializedmetadata']) > 0);
     // Check if data are saved for some specific View
     $modelMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='Note'");
     $this->assertTrue($modelMetadata['id'] > 0);
     $this->assertTrue(strlen($modelMetadata['serializedmetadata']) > 0);
     // Check if data are saved for some specific View
     $viewMetadata = ZurmoRedBean::getRow("SELECT * FROM globalmetadata WHERE classname='ContactsListView'");
     $this->assertTrue($viewMetadata['id'] > 0);
     $this->assertTrue(strlen($viewMetadata['serializedmetadata']) > 0);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:ManageMetadataCommandTest.php

示例3: testRun

 public function testRun()
 {
     //Create 2 jobLogs, and set one with a date over a week ago (8 days ago) for the endDateTime
     $eightDaysAgoTimestamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() - 60 * 60 * 24 * 8);
     $jobLog = new JobLog();
     $jobLog->type = 'Monitor';
     $jobLog->startDateTime = $eightDaysAgoTimestamp;
     $jobLog->endDateTime = $eightDaysAgoTimestamp;
     $jobLog->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog->isProcessed = false;
     $jobLog->save();
     $jobLog2 = new JobLog();
     $jobLog2->type = 'ImportCleanup';
     $jobLog2->startDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog2->endDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime(time());
     $jobLog2->status = JobLog::STATUS_COMPLETE_WITHOUT_ERROR;
     $jobLog2->isProcessed = false;
     $jobLog2->save();
     $sql = 'select count(*) count from item';
     $row = ZurmoRedBean::getRow($sql);
     $this->assertEquals(4, $row['count']);
     $job = new JobLogCleanupJob();
     $this->assertTrue($job->run());
     $jobLogs = JobLog::getAll();
     $this->assertEquals(1, count($jobLogs));
     $this->assertEquals($jobLog2->id, $jobLogs[0]->id);
     $sql = 'select count(*) count from item';
     $row = ZurmoRedBean::getRow($sql);
     $this->assertEquals(3, $row['count']);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:30,代码来源:JobLogCleanupJobTest.php

示例4: getChartData

 public function getChartData()
 {
     $sql = static::makeSqlQuery(static::makeSearchAttributeData($this->autoresponder));
     $row = ZurmoRedBean::getRow($sql);
     $data = static::resolveChartDataBaseGroupElements();
     foreach ($data as $index => $notUsed) {
         if ($row[$index] != null) {
             $data[$index] = $row[$index];
         }
     }
     return $data;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:12,代码来源:AutoresponderGroupedChartDataProvider.php

示例5: testRecreateTable

 public function testRecreateTable()
 {
     ReadPermissionsSubscriptionUtil::recreateTable('account_read_subscription');
     $sql = 'INSERT INTO account_read_subscription VALUES (null, \'1\', \'2\', \'2013-05-03 15:16:06\', \'1\')';
     ZurmoRedBean::exec($sql);
     $accountReadSubscription = ZurmoRedBean::getRow("SELECT * FROM account_read_subscription");
     $this->assertTrue($accountReadSubscription['id'] > 0);
     $this->assertEquals(1, $accountReadSubscription['userid']);
     $this->assertEquals(2, $accountReadSubscription['modelid']);
     $this->assertEquals('2013-05-03 15:16:06', $accountReadSubscription['modifieddatetime']);
     $this->assertEquals(1, $accountReadSubscription['subscriptiontype']);
     $sql = 'DELETE FROM account_read_subscription';
     ZurmoRedBean::exec($sql);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:14,代码来源:ReadPermissionsSubscriptionUtilTest.php

示例6: getChartData

 /**
  * @return array
  */
 public function getChartData()
 {
     $chartData = array();
     $groupedDateTimeData = static::makeGroupedDateTimeData($this->beginDate, $this->endDate, $this->groupBy, false);
     foreach ($groupedDateTimeData as $groupData) {
         $beginDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeBeginningOfDay($groupData['beginDate']);
         $endDateTime = DateTimeUtil::convertDateIntoTimeZoneAdjustedDateTimeEndOfDay($groupData['endDate']);
         $searchAttributedata = static::makeSearchAttributeData($endDateTime, $this->marketingList);
         $sql = static::makeColumnSqlQuery($beginDateTime, $searchAttributedata);
         $row = ZurmoRedBean::getRow($sql);
         $columnData = array(MarketingChartDataProvider::NEW_SUBSCRIBERS_COUNT => ArrayUtil::getArrayValueAndResolveNullAsZero($row, static::NEW_SUBSCRIBERS_COUNT), MarketingChartDataProvider::EXISTING_SUBSCRIBERS_COUNT => ArrayUtil::getArrayValueAndResolveNullAsZero($row, static::EXISTING_SUBSCRIBERS_COUNT), 'displayLabel' => $groupData['displayLabel'], 'dateBalloonLabel' => $this->resolveDateBalloonLabel($groupData['displayLabel']));
         $chartData[] = $columnData;
     }
     return $chartData;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:18,代码来源:MarketingListGrowthChartDataProvider.php

示例7: testRebuilt

 public function testRebuilt()
 {
     ModelCreationApiSyncUtil::buildTable();
     $sql = 'INSERT INTO ' . ModelCreationApiSyncUtil::TABLE_NAME . ' VALUES (null, \'ApiServiceName\', \'1\', \'Contact\', \'2013-05-03 15:16:06\')';
     ZurmoRedBean::exec($sql);
     $apiServiceCreationRow = ZurmoRedBean::getRow('SELECT * FROM ' . ModelCreationApiSyncUtil::TABLE_NAME);
     $this->assertTrue($apiServiceCreationRow['id'] > 0);
     $this->assertEquals('ApiServiceName', $apiServiceCreationRow['servicename']);
     $this->assertEquals(1, $apiServiceCreationRow['modelid']);
     $this->assertEquals('Contact', $apiServiceCreationRow['modelclassname']);
     $this->assertEquals('2013-05-03 15:16:06', $apiServiceCreationRow['createddatetime']);
     // Now test when table already exist
     ModelCreationApiSyncUtil::buildTable();
     $apiServiceCreationRow = ZurmoRedBean::getRow('SELECT COUNT(*) as totalRows FROM ' . ModelCreationApiSyncUtil::TABLE_NAME);
     $this->assertEquals(1, $apiServiceCreationRow['totalRows']);
     $sql = 'INSERT INTO ' . ModelCreationApiSyncUtil::TABLE_NAME . ' VALUES (null, \'ApiServiceName\', \'2\', \'Contact\', \'2013-06-03 15:16:06\')';
     ZurmoRedBean::exec($sql);
     $apiServiceCreationRow = ZurmoRedBean::getRow('SELECT COUNT(*) as totalRows FROM ' . ModelCreationApiSyncUtil::TABLE_NAME);
     $this->assertEquals(2, $apiServiceCreationRow['totalRows']);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:20,代码来源:ModelCreationApiSyncUtilTest.php

示例8: testDeletingSenderAndRecipientsPersonsOrAccountsItems

 public function testDeletingSenderAndRecipientsPersonsOrAccountsItems()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $emailMessage = EmailMessageTestHelper::createDraftSystemEmail('test crud relations', $super);
     $contact = ContactTestHelper::createContactByNameForOwner('samson', $super);
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagerecipient_item');
     $this->assertEquals(0, $count['count']);
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagesender_item');
     $this->assertEquals(0, $count['count']);
     //Add contact as sender personOrAccounts
     $emailMessageSender = new EmailMessageSender();
     $emailMessageSender->fromAddress = 'system@somewhere.org';
     $emailMessageSender->fromName = 'system name';
     $emailMessageSender->personsOrAccounts->add($contact);
     $emailMessage->sender = $emailMessageSender;
     //Add also as recipient personOrAccounts
     $recipient = new EmailMessageRecipient();
     $recipient->toAddress = 'sam@fakeemail.com';
     $recipient->toName = 'Sam Sammy';
     $recipient->type = EmailMessageRecipient::TYPE_TO;
     $recipient->personsOrAccounts->add($contact);
     $emailMessage->recipients->add($recipient);
     //Save emailMessage
     $saved = $emailMessage->save();
     $this->assertTrue($saved);
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagerecipient_item');
     $this->assertEquals(1, $count['count']);
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagesender_item');
     $this->assertEquals(1, $count['count']);
     $emailMessage->forget();
     //Now delete the contact and try to retrieve the email message
     $deleted = $contact->delete();
     $this->assertTrue($deleted);
     //Now make sure the intermediate join table rows are removed
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagerecipient_item');
     $this->assertEquals(0, $count['count']);
     $count = ZurmoRedBean::getRow('select count(*) count from emailmessagesender_item');
     $this->assertEquals(0, $count['count']);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:40,代码来源:EmailMessagesObserverTest.php

示例9: getEntry

 public static function getEntry($identifier, $default = 'NOT_FOUND_EXCEPTION', $cacheDefaultValue = false)
 {
     try {
         return parent::getEntry($identifier, $default, $cacheDefaultValue);
     } catch (NotFoundException $e) {
         if (static::supportsAndAllowsDatabaseCaching()) {
             $row = ZurmoRedBean::getRow("select entry from actual_rights_cache " . "where identifier = '" . $identifier . "'");
             if ($row != null && isset($row['entry'])) {
                 //Calling parent because we don't need to re-cache the db cache item
                 parent::cacheEntry($identifier, $row['entry']);
                 return $row['entry'];
             }
         }
         if ($default === 'NOT_FOUND_EXCEPTION') {
             throw new NotFoundException();
         } else {
             if ($cacheDefaultValue) {
                 static::cacheEntry($identifier, $default);
             }
             return $default;
         }
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:23,代码来源:RightsCache.php

示例10: resolveMakeTemplateFunctionDefinitionById

 protected function resolveMakeTemplateFunctionDefinitionById($id, &$functionDefinitions, array &$functionNames)
 {
     $name = null;
     $builttype = null;
     $serializeddata = null;
     $emailTemplate = ZurmoRedBean::getRow('select name, builttype, serializeddata from emailtemplate where id =' . $id);
     if (empty($emailTemplate)) {
         throw new NotFoundException("Unable to load model for id: {$id}");
     }
     extract($emailTemplate);
     if ($builttype != EmailTemplate::BUILT_TYPE_BUILDER_TEMPLATE) {
         throw new NotSupportedException("id: {$id} is not a builder template");
     }
     $unserializedData = CJSON::decode($serializeddata);
     if (json_last_error() != JSON_ERROR_NONE || empty($unserializedData)) {
         throw new NotSupportedException("JSON could not be translated");
     }
     $unserializedData['baseTemplateId'] = '';
     $unserializedData['icon'] = ArrayUtil::getArrayValue($this->templateNameToIconMapping, $name);
     $unserializedData = var_export($unserializedData, true);
     $functionName = $this->resolveFunctionNameFromTemplateName($name);
     $functionNames[] = $functionName;
     $functionDefinitions .= "\n\nprotected function {$functionName}()\n{\n    \$name              = '{$name}';\n    \$unserializedData  = {$unserializedData};\n    \$this->makeBuilderPredefinedEmailTemplate(\$name, \$unserializedData);\n}";
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:24,代码来源:DefaultDataController.php

示例11: testRun

 public function testRun()
 {
     chdir(COMMON_ROOT . DIRECTORY_SEPARATOR . 'protected' . DIRECTORY_SEPARATOR . 'commands');
     $command = "php zurmocTest.php install {$this->temporaryDatabaseHostname} {$this->temporaryDatabaseName} ";
     $command .= "{$this->temporaryDatabaseUsername} {$this->temporaryDatabasePassword} {$this->temporaryDatabasePort} ";
     $command .= "{$this->superUserPassword} 'http://sampleHost' 'app/index.php' demodata 1";
     if (!IS_WINNT) {
         $command .= ' 2>&1';
     }
     exec($command, $output);
     $instanceRoot = INSTANCE_ROOT;
     $perInstanceConfigFile = "{$instanceRoot}/protected/config/perInstanceTest.php";
     $debugConfigFile = "{$instanceRoot}/protected/config/debugTest.php";
     $perInstanceConfiguration = file_get_contents($perInstanceConfigFile);
     $debugConfiguration = file_get_contents($debugConfigFile);
     //Check if config files is updated.
     $this->assertRegExp('/\\$connectionString = \'mysql:host=' . $this->temporaryDatabaseHostname . ';port=' . $this->temporaryDatabasePort . ';dbname=' . $this->temporaryDatabaseName . '\';/', $perInstanceConfiguration);
     $this->assertRegExp('/\\$username         = \'' . $this->temporaryDatabaseUsername . '\';/', $perInstanceConfiguration);
     $this->assertRegExp('/\\$password         = \'' . $this->temporaryDatabasePassword . '\';/', $perInstanceConfiguration);
     RedBeanDatabase::close();
     RedBeanDatabase::setup(Yii::app()->tempDb->connectionString, Yii::app()->tempDb->username, Yii::app()->tempDb->password, true);
     $count = ZurmoRedBean::getRow('select count(*) count from _user');
     if (Yii::app()->edition == 'Community') {
         $this->assertEquals(10, $count['count']);
     } else {
         $this->assertEquals(14, $count['count']);
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:28,代码来源:InstallCommandTest.php

示例12: getIdByCampaignOrAutoresponderItem

 /**
  * Get by campaign or autoresponder item.
  * @param OwnedModel $item
  * @return int
  */
 public static function getIdByCampaignOrAutoresponderItem($item)
 {
     $itemClassName = get_class($item);
     $type = strtolower($itemClassName);
     $modelClassName = $itemClassName . 'Activity';
     $tableName = $modelClassName::getTableName();
     $rows = ZurmoRedBean::getRow('select emailmessageactivity_id from ' . $tableName . ' where ' . $type . '_id = ?', array($item->id));
     if (!empty($rows)) {
         return $rows['emailmessageactivity_id'];
     }
     return null;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:17,代码来源:EmailMessageActivity.php

示例13: testMultipleManyManysToTheSameModel

 public function testMultipleManyManysToTheSameModel()
 {
     $pp1 = new PP();
     $pp1->name = 'pp1a';
     $pp1->save();
     $this->assertTrue($pp1->save());
     $pp1Id = $pp1->id;
     $pp2 = new PP();
     $pp2->name = 'pp2a';
     $this->assertTrue($pp2->save());
     $pp2Id = $pp2->id;
     $p = new P();
     $p->name = 'manyNames';
     $p->ppManyAssumptive->add($pp1);
     $p->ppManySpecific->add($pp2);
     $this->assertTrue($p->save());
     $pId = $p->id;
     //Retrieve row to make sure columns are coppect
     $row = ZurmoRedBean::getRow('select * from p');
     $this->assertCount(5, $row);
     $this->assertEquals(1, ZurmoRedBean::count('p_pp'));
     $row = ZurmoRedBean::getRow('select * from p_pp');
     $this->assertTrue(isset($row['p_id']) && ($row['p_id'] = $p->id));
     $this->assertTrue(isset($row['pp_id']) && ($row['pp_id'] = $pp1->id));
     $this->assertCount(3, $row);
     $this->assertEquals(1, ZurmoRedBean::count('ppmanyspecificlink_p_pp'));
     $row = ZurmoRedBean::getRow('select * from ppmanyspecificlink_p_pp');
     $this->assertTrue(isset($row['p_id']) && ($row['p_id'] = $p->id));
     $this->assertTrue(isset($row['pp_id']) && ($row['pp_id'] = $pp2->id));
     $this->assertCount(3, $row);
     //Unlink and make sure the tables are cleared
     $p->forget();
     $pp1->forget();
     $pp2->forget();
     $p = P::getById($pId);
     $this->assertEquals(1, $p->ppManyAssumptive->count());
     $this->assertEquals(1, $p->ppManySpecific->count());
     $p->ppManyAssumptive->removeAll();
     $p->ppManySpecific->removeAll();
     $this->assertTrue($p->save());
     $this->assertEquals(0, ZurmoRedBean::count('p_pp'));
     $this->assertEquals(0, ZurmoRedBean::count('ppmanyspecificlink_p_pp'));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:43,代码来源:RedBeanModelMulitpleSameModelRelationsTest.php

示例14: getDatabaseMaxAllowedPacketsSizeRb

 /**
  * Get database max alowed packet size.
  * @throws NotSupportedException
  */
 public static function getDatabaseMaxAllowedPacketsSizeRb()
 {
     if (RedBeanDatabase::getDatabaseType() != 'mysql') {
         throw new NotSupportedException();
     }
     $row = ZurmoRedBean::getRow("SHOW VARIABLES LIKE 'max_allowed_packet'");
     if (isset($row['Value'])) {
         return $row['Value'];
     } else {
         return null;
     }
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:16,代码来源:DatabaseCompatibilityUtil.php

示例15: testPolyOneToManyNotOwned

 public function testPolyOneToManyNotOwned()
 {
     $polySide = new TestPolyOneToManyPolySide();
     $polySide->name = 'polySideTest';
     $oneSide = new TestPolyOneToManyOneSide();
     $oneSide->name = 'oneSideTest';
     $oneSide->polys->add($polySide);
     $this->assertTrue($oneSide->save());
     $polySideId = $polySide->id;
     $this->assertTrue($polySideId > 0);
     $oneSideId = $oneSide->id;
     $oneSide->forget();
     unset($oneSide);
     $polySide2 = new TestPolyOneToManyPolySide();
     $polySide2->name = 'polySideTest2';
     $oneSide2 = new TestPolyOneToManyOneSideTwo();
     $oneSide2->name = 'oneSideTwoTest';
     $oneSide2->polysTwo->add($polySide2);
     $this->assertTrue($oneSide2->save());
     $polySide2Id = $polySide2->id;
     $this->assertTrue($polySide2Id > 0);
     $oneSide2Id = $oneSide2->id;
     $oneSide2->forget();
     unset($oneSide2);
     //Get oneSide and make sure it has one polySide that matches the appropriate id
     $oneSide = TestPolyOneToManyOneSide::getById($oneSideId);
     $this->assertEquals(1, $oneSide->polys->count());
     $this->assertEquals($polySideId, $oneSide->polys[0]->id);
     //Get oneSide2 and make sure it has one polySide2 that matches the appropriate id
     $oneSide2 = TestPolyOneToManyOneSideTwo::getById($oneSide2Id);
     $this->assertEquals(1, $oneSide2->polysTwo->count());
     $this->assertEquals($polySide2Id, $oneSide2->polysTwo[0]->id);
     //do a direct sql to get the row for polySide
     $row = ZurmoRedBean::getRow('select * from testpolyonetomanypolyside');
     $this->assertTrue(!isset($row['testpolyonetomanyoneside_id']));
     $this->assertTrue(!isset($row['testpolyonetomanyonesidetwo_id']));
     //Confirm the poly type and poly id columns are there.
     $this->assertTrue(isset($row['polytest_type']));
     $this->assertTrue(isset($row['polytest_id']));
     //test adding an extra PolySide to oneSide
     $polySide3 = new TestPolyOneToManyPolySide();
     $polySide3->name = 'polySideTest3';
     $oneSide->polys->add($polySide3);
     $this->assertTrue($oneSide->save());
     $polySide3Id = $polySide3->id;
     $oneSide->forget();
     unset($oneSide);
     //Now test there are 2 related polys
     $oneSide = TestPolyOneToManyOneSide::getById($oneSideId);
     $this->assertEquals(2, $oneSide->polys->count());
     $this->assertEquals($polySideId, $oneSide->polys[0]->id);
     $this->assertEquals($polySide3Id, $oneSide->polys[1]->id);
     //test disconnect a polySide, it should also remove the attached model from db. TestPolyOneToManyPolySide should be three
     $polySide = $oneSide->polys[0];
     $oneSide->polys->remove($polySide);
     $this->assertTrue($oneSide->save());
     $this->assertEquals(2, TestPolyOneToManyPolySide::getCount());
     //Now test there is 1 related polys
     $oneSide = TestPolyOneToManyOneSide::getById($oneSideId);
     $this->assertEquals(1, $oneSide->polys->count());
     $this->assertEquals($polySide3Id, $oneSide->polys[0]->id);
     $this->assertEquals(2, TestPolyOneToManyPolySide::getCount());
     $this->assertTrue($oneSide->delete());
     $this->assertEquals(1, TestPolyOneToManyPolySide::getCount());
     TestPolyOneToManyPolySide::deleteAll();
     $this->assertEquals(0, TestPolyOneToManyPolySide::getCount());
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:67,代码来源:RedBeanModelPolyOneToManyTest.php


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