本文整理汇总了PHP中Person::QueryArray方法的典型用法代码示例。如果您正苦于以下问题:PHP Person::QueryArray方法的具体用法?PHP Person::QueryArray怎么用?PHP Person::QueryArray使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Person
的用法示例。
在下文中一共展示了Person::QueryArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAlias1
public function testAlias1()
{
$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)));
$this->assertEqual(sizeof($objPersonArray), 3);
$this->verifyObjectPropertyHelper($objPersonArray, 'FirstName', 'Kendall');
$this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Wolfe');
$this->verifyObjectPropertyHelper($objPersonArray, 'LastName', 'Smith');
}
示例2: dtgPersons_Bind
protected function dtgPersons_Bind()
{
// We must first let the datagrid know how many total items there are
$this->dtgPersons->TotalItemCount = Person::QueryCount($this->dtgPersons->Conditions);
// Next, we must be sure to load the data source, passing in the datagrid's
// limit info into our loadall method.
$this->dtgPersons->DataSource = Person::QueryArray($this->dtgPersons->Conditions, QQ::Clause($this->dtgPersons->OrderByClause, $this->dtgPersons->LimitClause));
}
示例3: auto_Bind
public function auto_Bind($strFormId, $strControlId, $term)
{
$cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $term . '%'), QQ::Like(QQN::Person()->LastName, '%' . $term . '%'));
$a = Person::QueryArray($cond);
$items = array();
foreach ($a as $obj) {
$items[] = new QListItem($obj->FirstName . ' ' . $obj->LastName, $obj->Id);
}
$this->auto2->DataSource = $items;
}
示例4: dtgItems_Bind
public function dtgItems_Bind()
{
$intYear = QApplication::PathInfo(0);
$dttStart = new QDateTime($intYear . '-01-01');
$dttEnd = new QDateTime($dttStart);
$dttEnd->Year += 1;
$dttStart->SetTime(null, null, null);
$dttEnd->SetTime(null, null, null);
$this->dtgItems->DataSource = Person::QueryArray(QQ::AndCondition(QQ::GreaterOrEqual(QQN::Person()->StewardshipContribution->DateCredited, $dttStart), QQ::LessThan(QQN::Person()->StewardshipContribution->DateCredited, $dttEnd), QQ::IsNull(QQN::Person()->PrimaryAddressText), QQ::IsNull(QQN::Person()->StewardshipAddressId)), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
}
示例5: testAssociationTables
public function testAssociationTables()
{
// All People Who Are on a Project Managed by Karen Wolfe (Person ID #7)
$objPersonArray = Person::QueryArray(QQ::Equal(QQN::Person()->ProjectAsTeamMember->Project->ManagerPersonId, 7), QQ::Clause(QQ::Distinct(), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
$arrNamesOnly = array();
foreach ($objPersonArray as $item) {
$arrNamesOnly[] = $item->FirstName . " " . $item->LastName;
}
$this->assertEqual($arrNamesOnly, array("Brett Carlisle", "John Doe", "Samantha Jones", "Jacob Pratt", "Kendall Public", "Ben Robinson", "Alex Smith", "Wendy Smith", "Karen Wolfe"), "List managed persons is correct");
}
示例6: testSelectSubsetInExpand
public function testSelectSubsetInExpand()
{
$objPersonArray = Person::QueryArray(QQ::OrCondition(QQ::Like(QQN::Person()->ProjectAsManager->Name, '%ACME%'), QQ::Like(QQN::Person()->ProjectAsManager->Name, '%HR%')), QQ::Clause(QQ::Select(QQN::Person()->LastName), QQ::Expand(QQN::Person()->ProjectAsManager, null, QQ::Select(QQN::Person()->ProjectAsManager->Spent)), QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName)));
foreach ($objPersonArray as $objPerson) {
$this->assertNull($objPerson->FirstName, "FirstName should be null, since it was not selected");
$this->assertNotNull($objPerson->Id, "Id should not be null since it's always added to the select list");
$this->assertNotNull($objPerson->_ProjectAsManager->Id, "ProjectAsManager->Id should not be null since id's are always added to the select list");
$this->assertNull($objPerson->_ProjectAsManager->Name, "ProjectAsManager->Name should be null since it was not selected");
}
}
示例7: BindData
protected function BindData()
{
if ($strFilter = $this->dtgTable->Search["search"]) {
$objCondition = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strFilter . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strFilter . '%'));
} else {
$objCondition = QQ::All();
}
$this->dtgTable->TotalItemCount = Person::QueryCount($objCondition);
$objClauses[] = $this->dtgTable->OrderByClause;
$objClauses[] = $this->dtgTable->LimitClause;
$this->dtgTable->DataSource = Person::QueryArray($objCondition, $objClauses);
}
示例8: dtgMembers_Bind
public function dtgMembers_Bind()
{
$objCondition = QQ::In(QQN::Person()->GroupParticipation->GroupId, $this->intGroupIdArray);
$objCondition = QQ::AndCondition($objCondition, QQ::IsNull(QQN::Person()->GroupParticipation->DateEnd));
$this->dtgMembers->TotalItemCount = Person::QueryCount($objCondition);
$objClauses = array(QQ::Distinct());
if ($objClause = $this->dtgMembers->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgMembers->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgMembers->DataSource = Person::QueryArray($objCondition, $objClauses);
}
示例9: 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'));
}
示例10: getList
protected function getList($strTerm = null, $blnHtml = false)
{
if ($strTerm) {
$cond = QQ::OrCondition(QQ::Like(QQN::Person()->FirstName, '%' . $strTerm . '%'), QQ::Like(QQN::Person()->LastName, '%' . $strTerm . '%'));
} else {
$cond = QQ::All();
}
$clauses[] = QQ::OrderBy(QQN::Person()->LastName, QQN::Person()->FirstName);
$lst = Person::QueryArray($cond, $clauses);
$a = array();
foreach ($lst as $objPerson) {
$item = new QListItem($objPerson->FirstName . ' ' . $objPerson->LastName, $objPerson->Id);
if ($blnHtml) {
$item->Label = '<em>' . $objPerson->FirstName . ' ' . $objPerson->LastName . '</em>';
}
$a[] = $item;
}
return $a;
}
示例11: dtgMembers_Bind
public function dtgMembers_Bind()
{
$objConditions = QQ::Equal(QQN::Person()->GroupParticipation->GroupId, $this->objGroup->Id);
$this->dtgMembers->TotalItemCount = Person::QueryCount($objConditions);
if ($strName = trim($this->txtFirstName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->FirstName, $strName . '%'));
}
if ($strName = trim($this->txtLastName->Text)) {
$objConditions = QQ::AndCondition($objConditions, QQ::Like(QQN::Person()->LastName, $strName . '%'));
}
$objClauses = array(QQ::Distinct());
if ($objClause = $this->dtgMembers->LimitClause) {
$objClauses[] = $objClause;
}
if ($objClause = $this->dtgMembers->OrderByClause) {
$objClauses[] = $objClause;
}
$this->dtgMembers->DataSource = Person::QueryArray($objConditions, $objClauses);
}
示例12: COUNT
<p>Note: the code below generates <a href="http://docs.hp.com/en/36216-90103/ch03s02.html">
correlated (dependent) subqueries</a>. These are frequently not the
fastest way to run queries against your SQL engine. If there is an
opportunity to rewrite your subquery using simple joins, do it - this
will improve the performance of your applications dramatically.</p>
<p>In general, it's a good idea to use EXPLAIN statements to determine
the query execution plan of the SQL statement that QQuery generates
to determine what the SQL engine will actually do to run your queries.
This is one of the best ways to improve the performance of your
database-driven application.</p>
</div>
<div id="demoZone">
<h2>Select names of project managers whose projects are over budget by at least $20</h2>
<?php
QApplication::$Database[1]->EnableProfiling();
$objPersonArray = Person::QueryArray(QQ::IsNotNull(QQ::Virtual('over_budget_projects', QQ::SubSql("SELECT COUNT(*)\n\t\t\t\t\t\t\tFROM project\n\t\t\t\t\t\t\tWHERE (spent - budget > 20)\n\t\t\t\t\t\t\t\tAND manager_person_id={1}\n\t\t\t\t\t\t\tGROUP BY manager_person_id", QQN::Person()->Id))), QQ::Clause(QQ::OrderBy(QQ::Virtual('over_budget_projects'), false), QQ::Expand(QQ::Virtual('over_budget_projects'))));
foreach ($objPersonArray as $objPerson) {
_p($objPerson->FirstName . ' ' . $objPerson->LastName . ': ' . $objPerson->GetVirtualAttribute("over_budget_projects") . " project(s) over budget");
_p('<br/>', false);
}
?>
<p><?php
QApplication::$Database[1]->OutputProfiling();
?>
</p>
</div>
<?php
require '../includes/footer.inc.php';
示例13: CalculatePotentialSenderArray
/**
* Given a valid From EmailAddress, this will lookup and return a "Sender" array, a 3-item array containing:
* Login
* CommunicationListEntry
* Person[]
* that would correspond to this From EmailAddress. Note that any one of those indexes can also be null
* if there is no object corresponding to this From Email Address.
* @return mixed[]
*/
protected function CalculatePotentialSenderArray()
{
$objArrayToReturn = array();
$objArrayToReturn[] = Login::LoadByEmail($this->FromAddress);
$objArrayToReturn[] = CommunicationListEntry::LoadByEmail($this->FromAddress);
// Get all Person objects that have this as an email address
$objArrayToReturn[] = Person::QueryArray(QQ::Equal(QQN::Person()->Email->Address, $this->FromAddress), QQ::Distinct());
return $objArrayToReturn;
}
示例14: dtgPerson_Bind
protected function dtgPerson_Bind()
{
$dtAfterValue = new QDateTime($this->dtxAfterValue->Text);
$dtBeforeValue = new QDateTime($this->dtxBeforeValue->Text);
$objConditions = QQ::All();
$objConditions = QQ::AndCondition($objConditions, QQ::GreaterOrEqual(QQN::Person()->Comment->DatePosted, $dtAfterValue));
$objConditions = QQ::AndCondition($objConditions, QQ::LessOrEqual(QQN::Person()->Comment->DatePosted, $dtBeforeValue));
$objConditions = QQ::AndCondition($objConditions, QQ::Equal(QQN::Person()->Comment->CommentCategory->Name, "Pastoral"));
$this->dtgPerson->TotalItemCount = count(Person::QueryArray($objConditions));
$objPersonArray = Person::QueryArray($objConditions, $this->dtgPerson->LimitClause);
$this->dtgPerson->DataSource = $objPersonArray;
}
示例15: LoadArrayBySearch
public static function LoadArrayBySearch($strName, $objClauses = null)
{
$objCondition = QQ::All();
if (!$objClauses) {
$objClauses = array();
}
self::PrepareQqForSearch($strName, $objCondition, $objClauses);
return Person::QueryArray($objCondition, $objClauses);
}