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


PHP QQ::Sub方法代码示例

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


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

示例1: foreach

<?php 
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Virtual('diff', QQ::MathOp('+', QQN::Person()->ProjectAsManager->Spent, QQ::Neg(QQN::Person()->ProjectAsManager->Budget))), 20), QQ::Clause(QQ::OrderBy(QQ::Virtual('diff'), 'DESC'), QQ::Expand(QQ::Virtual('diff')), QQ::Select(array(QQ::Virtual('diff'), QQN::Person()->FirstName, QQN::Person()->LastName))));
foreach ($objPersonArray as $objPerson) {
    _p($objPerson->FirstName . ' ' . $objPerson->LastName) . ' : ' . $objPerson->GetVirtualAttribute('diff');
    _p('<br/>', false);
}
?>
	<p><?php 
QApplication::$Database[1]->OutputProfiling();
?>
</p>

	<h2>SQL Function Example</h2>
	<p>Use the QQ::Abs and QQ::Sub functions to retrieve projects both over-budget and under-budget by $20.</p>
<?php 
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Virtual('absdiff', QQ::Abs(QQ::Sub(QQN::Person()->ProjectAsManager->Spent, QQN::Person()->ProjectAsManager->Budget))), 20), QQ::Clause(QQ::OrderBy(QQ::Virtual('absdiff'), 'DESC'), QQ::Expand(QQ::Virtual('absdiff')), QQ::Select(array(QQ::Virtual('absdiff'), QQN::Person()->FirstName, QQN::Person()->LastName))));
foreach ($objPersonArray as $objPerson) {
    _p($objPerson->FirstName . ' ' . $objPerson->LastName) . ' : ' . $objPerson->GetVirtualAttribute('diff');
    _p('<br/>', false);
}
?>
	<p><?php 
QApplication::$Database[1]->OutputProfiling();
?>
</p>
</div>

<?php 
require '../includes/footer.inc.php';
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:31,代码来源:qqfuncnmath.php

示例2: testVirtualAttributeAliases

 public function testVirtualAttributeAliases()
 {
     $clauses = [QQ::GroupBy(QQN::Project()->ProjectStatusTypeId), QQ::Sum(QQN::Project()->Budget, 'Budget Amount'), QQ::Expand(QQ::Virtual('Balance', QQ::Func('SUM', QQ::Sub(QQN::Project()->Budget, QQN::Project()->Spent))))];
     $cond = QQ::Equal(QQN::Project()->ProjectStatusTypeId, ProjectStatusType::Open);
     $objProject = Project::QuerySingle($cond, $clauses);
     $amount1 = $objProject->GetVirtualAttribute('Budget Amount');
     $this->assertEquals(83000, $amount1);
     $amount2 = $objProject->GetVirtualAttribute('Balance');
     $this->assertEquals(5599.5, $amount2);
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:10,代码来源:BasicOrmTest.php

示例3: testExample

 /**
  * Tests to ensure the example to work
  */
 public function testExample()
 {
     $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Sub(QQN::Person()->ProjectAsManager->Spent, QQN::Person()->ProjectAsManager->Budget), 20));
     $this->assertGreaterThan(0, count($objPersonArray));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNotNull($objPerson->FirstName);
         $this->assertNotNull($objPerson->LastName);
     }
     $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Virtual('diff', QQ::Sub(QQN::Person()->ProjectAsManager->Spent, QQN::Person()->ProjectAsManager->Budget)), 20), QQ::Clause(QQ::OrderBy(QQ::Virtual('diff'), 'DESC'), QQ::Expand(QQ::Virtual('diff'))));
     $this->assertGreaterThan(0, count($objPersonArray));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNotNull($objPerson->FirstName);
         $this->assertNotNull($objPerson->LastName);
         $this->assertNotNull($objPerson->GetVirtualAttribute('diff'));
     }
     $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Virtual('diff', QQ::MathOp('-', QQN::Person()->ProjectAsManager->Spent, QQN::Person()->ProjectAsManager->Budget)), 20), QQ::Clause(QQ::OrderBy(QQ::Virtual('diff'), 'DESC'), QQ::Expand(QQ::Virtual('diff')), QQ::Select(array(QQ::Virtual('diff'), QQN::Person()->FirstName, QQN::Person()->LastName))));
     $this->assertGreaterThan(0, count($objPersonArray));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNotNull($objPerson->FirstName);
         $this->assertNotNull($objPerson->LastName);
         $this->assertNotNull($objPerson->GetVirtualAttribute('diff'));
     }
     $objPersonArray = Person::QueryArray(QQ::GreaterThan(QQ::Virtual('absdiff', QQ::Abs(QQ::Sub(QQN::Person()->ProjectAsManager->Spent, QQN::Person()->ProjectAsManager->Budget))), 20), QQ::Clause(QQ::OrderBy(QQ::Virtual('absdiff'), 'DESC'), QQ::Expand(QQ::Virtual('absdiff')), QQ::Select(array(QQ::Virtual('absdiff'), QQN::Person()->FirstName, QQN::Person()->LastName))));
     $this->assertGreaterThan(0, count($objPersonArray));
     foreach ($objPersonArray as $objPerson) {
         $this->assertNotNull($objPerson->FirstName);
         $this->assertNotNull($objPerson->LastName);
         $this->assertNotNull($objPerson->GetVirtualAttribute('absdiff'));
     }
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:33,代码来源:QQMathOpTest.php


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