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


PHP QQ::Alias方法代码示例

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


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

示例1: testAlias3

 public function testAlias3()
 {
     $emptySelect = QQ::Select();
     $emptySelect->SetSkipPrimaryKey(true);
     $nVoyel = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'voyel');
     $nConson = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'conson');
     $objPersonArray = Person::QueryArray(QQ::IsNotNull($nConson->Id), QQ::Clause(QQ::Expand($nVoyel, QQ::In($nVoyel->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::Expand($nConson, QQ::NotIn($nConson->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::GroupBy(QQN::Person()->Id), QQ::Minimum($nVoyel->Name, 'min_voyel'), QQ::Minimum($nConson->Name, 'min_conson'), QQ::Expand(QQN::Person()->ProjectAsManager, null, $emptySelect), QQ::Minimum(QQN::Person()->ProjectAsManager->Id, 'dummy'), QQ::Select(QQN::Person()->FirstName, QQN::Person()->LastName)));
     $this->assertEquals(3, sizeof($objPersonArray));
     $obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Doe');
     $this->assertNull($obj->GetVirtualAttribute('min_voyel'));
     $this->assertEquals('Milestone F', $obj->GetVirtualAttribute('min_conson'));
     $obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Ho');
     $this->assertEquals('Milestone E', $obj->GetVirtualAttribute('min_voyel'));
     $this->assertEquals('Milestone D', $obj->GetVirtualAttribute('min_conson'));
     $obj = $this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Wolfe');
     $this->assertEquals('Milestone A', $obj->GetVirtualAttribute('min_voyel'));
     $this->assertEquals('Milestone B', $obj->GetVirtualAttribute('min_conson'));
 }
开发者ID:vaibhav-kaushal,项目名称:qc-framework,代码行数:18,代码来源:QQAliasTest.php

示例2: projects

	<p>In a slightly more complex example 2 below, we are looking for all projects that
	are associated with two other projects (each is specified by name). We use the
	same technique with <b>QQ::Alias()</b> as in example 1, except that we now
	mix it in with relationships expanded to other tables.</p>
</div>

<div id="demoZone">
	<h2>Example 1: Project members whose are in both project 1 and 2</h2>
<?php 
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::QueryArray(QQ::AndCondition(QQ::Equal(QQ::Alias(QQN::Person()->ProjectAsTeamMember, 'pm1')->ProjectId, 1), QQ::Equal(QQ::Alias(QQN::Person()->ProjectAsTeamMember, 'pm2')->ProjectId, 2)));
foreach ($objPersonArray as $objPerson) {
    _p($objPerson->FirstName . ' ' . $objPerson->LastName);
    _p('<br/>', false);
}
?>

	<h2>Example 2: Projects that are related to both 'Blueman Industrial Site Architecture' and 'ACME Payment System' projects</h2>
<?php 
$objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related1')->Project->Name, 'Blueman Industrial Site Architecture'), QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related2')->Project->Name, 'ACME Payment System')));
foreach ($objProjectArray as $objProject) {
    _p($objProject->Name . " (" . $objProject->Description . ")");
    _p('<br/>', false);
}
QApplication::$Database[1]->OutputProfiling();
?>
</div>

<?php 
require '../includes/footer.inc.php';
开发者ID:tomVertuoz,项目名称:framework,代码行数:30,代码来源:alias.php

示例3: array

}
?>

	<h2>Example 3: Managers having one least a project with a conson milestone, and for each manager, the first voyel milestone and the first conson one</h2>
<?php 
$emptySelect = QQ::Select();
$emptySelect->SetSkipPrimaryKey(true);
$nVoyel = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'voyel');
$nConson = QQ::Alias(QQN::Person()->ProjectAsManager->Milestone, 'conson');
$objPersonArray = Person::QueryArray(QQ::IsNotNull($nConson->Id), QQ::Clause(QQ::Expand(QQN::Person()->ProjectAsManager, null, $emptySelect), QQ::Expand($nVoyel, QQ::In($nVoyel->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::Expand($nConson, QQ::NotIn($nConson->Name, array('Milestone A', 'Milestone E', 'Milestone I')), $emptySelect), QQ::GroupBy(QQN::Person()->Id), QQ::Minimum($nVoyel->Name, 'min_voyel'), QQ::Minimum($nConson->Name, 'min_conson'), QQ::Expand(QQN::Person()->ProjectAsManager, null, $emptySelect), QQ::Minimum(QQN::Person()->ProjectAsManager->Id, 'dummy'), QQ::Select(QQN::Person()->FirstName, QQN::Person()->LastName)));
foreach ($objPersonArray as $objManager) {
    _p($objManager->FirstName . ' ' . $objManager->LastName . " (" . $objManager->GetVirtualAttribute('min_voyel') . ', ' . $objManager->GetVirtualAttribute('min_conson') . ")");
    _p('<br/>', false);
}
?>

	<h2>Example 4: Projects with, for each one, the "min" city from the addresses containing 'r' and the "min" city from the addresses NOT containing 'r' </h2>
<?php 
$nWithR = QQ::Alias(QQN::Project()->PersonAsTeamMember->Person->Address, 'with_r');
$nWithoutR = QQ::Alias(QQN::Project()->PersonAsTeamMember->Person->Address, 'without_r');
$objProjectArray = Project::QueryArray(QQ::All(), QQ::Clause(QQ::Expand($nWithR, QQ::Like($nWithR->Street, '%r%')), QQ::Expand($nWithoutR, QQ::NotLike($nWithoutR->Street, '%r%')), QQ::GroupBy(QQN::Project()->Id), QQ::Minimum($nWithR->City, 'min_city_r'), QQ::Minimum($nWithoutR->City, 'min_city_wor')));
foreach ($objProjectArray as $objProject) {
    _p($objProject->Name . " (" . $objProject->GetVirtualAttribute('min_city_r') . ', ' . $objProject->GetVirtualAttribute('min_city_wor') . ")");
    _p('<br/>', false);
}
QApplication::$Database[1]->OutputProfiling();
?>
</div>

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

示例4: testAlias2

 public function testAlias2()
 {
     $objProjectArray = Project::QueryArray(QQ::AndCondition(QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related1')->Project->Name, 'Blueman Industrial Site Architecture'), QQ::Equal(QQ::Alias(QQN::Project()->ProjectAsRelated, 'related2')->Project->Name, 'ACME Payment System')));
     $this->assertEqual(sizeof($objProjectArray), 1);
     $this->verifyObjectPropertyHelper($objProjectArray, 'Name', 'ACME Website Redesign');
 }
开发者ID:tomVertuoz,项目名称:framework,代码行数:6,代码来源:QQAliasTests.php


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