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


PHP EmailMessage::makeSubsetOrCountSqlQuery方法代码示例

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


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

示例1: testResolveSearchAttributesDataByRelatedItemIdWithRegularUser

 public function testResolveSearchAttributesDataByRelatedItemIdWithRegularUser()
 {
     Yii::app()->user->userModel = User::getByUsername('benny');
     $mungeIds = ReadPermissionsOptimizationUtil::getMungeIdsByUser(Yii::app()->user->userModel);
     $quote = DatabaseCompatibilityUtil::getQuote();
     $rules = new EmailMessageMashableActivityRules();
     $searchAttributeData = $rules->resolveSearchAttributesDataByRelatedItemId(5);
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('EmailMessage');
     $where = RedBeanModelDataProvider::makeWhere('EmailMessage', $searchAttributeData, $joinTablesAdapter);
     $compareWhere = "(({$quote}emailmessagesender{$quote}.{$quote}personoraccount_item_id{$quote} = 5) or (1 = ";
     $compareWhere .= "(select 1 from {$quote}emailmessagerecipient{$quote} emailmessagerecipient where ";
     $compareWhere .= "{$quote}emailmessagerecipient{$quote}.{$quote}emailmessage_id` = {$quote}emailmessage";
     $compareWhere .= "{$quote}.id and {$quote}emailmessagerecipient{$quote}.{$quote}personoraccount_item_id` = 5 limit 1)))";
     $this->assertEquals($compareWhere, $where);
     $sql = EmailMessage::makeSubsetOrCountSqlQuery('emailmessage', $joinTablesAdapter, 1, 5, $where, null);
     $compareSubsetSql = "select distinct {$quote}emailmessage{$quote}.{$quote}id{$quote} id ";
     $compareSubsetSql .= "from ({$quote}emailmessage{$quote}, {$quote}ownedsecurableitem{$quote}) ";
     $compareSubsetSql .= "left join {$quote}emailmessagesender{$quote} on ";
     $compareSubsetSql .= "{$quote}emailmessagesender{$quote}.{$quote}id{$quote} = {$quote}emailmessage{$quote}.";
     $compareSubsetSql .= "{$quote}sender_emailmessagesender_id{$quote} ";
     $compareSubsetSql .= "left join {$quote}emailmessage_read{$quote} on ";
     $compareSubsetSql .= "{$quote}emailmessage_read{$quote}.{$quote}securableitem_id{$quote} = ";
     $compareSubsetSql .= "{$quote}ownedsecurableitem{$quote}.{$quote}securableitem_id{$quote} ";
     $compareSubsetSql .= "and {$quote}munge_id{$quote} in ('" . join("', '", $mungeIds) . "') ";
     $compareSubsetSql .= "where (" . $compareWhere . ') ';
     $compareSubsetSql .= "and ({$quote}ownedsecurableitem{$quote}.{$quote}owner__user_id{$quote} = " . Yii::app()->user->userModel->id . " ";
     // Not Coding Standard
     $compareSubsetSql .= "OR {$quote}emailmessage_read{$quote}.{$quote}munge_id{$quote} IS NOT NULL) ";
     // Not Coding Standard
     $compareSubsetSql .= "and {$quote}ownedsecurableitem{$quote}.{$quote}id{$quote} = ";
     $compareSubsetSql .= "{$quote}emailmessage{$quote}.{$quote}ownedsecurableitem_id{$quote} ";
     $compareSubsetSql .= 'limit 5 offset 1';
     $this->assertEquals($compareSubsetSql, $sql);
     //Make sure the sql runs properly.
     $data = EmailMessage::getSubset($joinTablesAdapter, 0, 5, $where, null);
     $this->assertEquals(0, count($data));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:37,代码来源:EmailMessageMashableActivityRulesTest.php


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