本文整理匯總了PHP中Person::QuerySingle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Person::QuerySingle方法的具體用法?PHP Person::QuerySingle怎麽用?PHP Person::QuerySingle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Person
的用法示例。
在下文中一共展示了Person::QuerySingle方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Run
/**
* Main DataGen Runner
* @return void
*/
public static function Run()
{
self::$SystemStartDate = new QDateTime('2004-01-01');
self::$MaximumPersonId = Person::QuerySingle(QQ::All(), QQ::OrderBy(QQN::Person()->Id, false))->Id;
self::DisplayForEachTaskStart($strDescription = 'Generating Signup Forms for Ministry', Ministry::CountByActiveFlag(true));
foreach (Ministry::LoadArrayByActiveFlag(true) as $objMinistry) {
self::DisplayForEachTaskNext($strDescription);
$intCount = rand(self::FormsPerMinistryMinimum, self::FormsPerMinistryMaximum);
self::DisplayForEachTaskStart($strDescriptionInside = ' Generating Signup Forms', $intCount);
for ($i = 0; $i < $intCount; $i++) {
self::DisplayForEachTaskNext($strDescriptionInside);
self::GenerateFormInMinistry($objMinistry);
}
self::DisplayForEachTaskEnd($strDescriptionInside, true);
}
self::DisplayForEachTaskEnd($strDescription);
}
示例2: testQuerySingleEmpty
public function testQuerySingleEmpty()
{
$targetPerson = Person::QuerySingle(QQ::Equal(QQN::Person()->Id, 1241243));
$this->assertEqual($targetPerson, null, "QuerySingle should return null for a not-found record");
}
示例3: LoadByPrimaryEmailId
/**
* Load a single Person object,
* by PrimaryEmailId Index(es)
* @param integer $intPrimaryEmailId
* @return Person
*/
public static function LoadByPrimaryEmailId($intPrimaryEmailId, $objOptionalClauses = null)
{
return Person::QuerySingle(QQ::Equal(QQN::Person()->PrimaryEmailId, $intPrimaryEmailId), $objOptionalClauses);
}
示例4: testOrderByReverseReference
public function testOrderByReverseReference()
{
// orders by the private key of the reverse reference node.
$objPerson = Person::QuerySingle(QQ::IsNotNull(QQN::Person()->ProjectAsManager->Id), [QQ::OrderBy(QQN::Person()->ProjectAsManager)]);
$this->assertEquals(7, $objPerson->Id, "Manager of first project found.");
}
示例5: constructs
The next few examples will examine all three major constructs (<b>QQ Node</b>, <b>QQ Condition</b> and <b>QQ Clause</b>) in greater
detail.<br/><br/>
And as a final note, notice that <b>Qcodo Query</b> doesn't have any construct to describe what would normally be your SELECT clause.
This is because we take advantage of the code generation process to allow <b>Qcodo Query</b> to automagically "know" which
fields that should be SELECT-ed based on the query, conditions and clauses you are performing. This will allow a lot
greater flexbility in your data model. Because the framework is now taking care of column names, etc., instead of the
developer needing to manually hard code it, you can make changes to columns in your tables without needing to rewrite
your <b>Qcodo Query</b> calls.
</div>
<h3>QuerySingle Example</h3>
<?php
$objPerson = Person::QuerySingle(QQ::Equal(QQN::Person()->Id, 1));
// Notice that QuerySingle returned just a single Person object
_p($objPerson->FirstName . ' ' . $objPerson->LastName);
_p('<br/>', false);
?>
<h3>QueryArray Example</h3>
<?php
$objPersonArray = Person::QueryArray(QQ::In(QQN::Person()->Id, array(5, 6, 8)));
// Notice that QueryArray returns an array of Person objects... this will
// be true even if the result set only yields 1 row.=
foreach ($objPersonArray as $objPerson) {
_p($objPerson->FirstName . ' ' . $objPerson->LastName);
_p('<br/>', false);
示例6: LoadByEmail
/**
* Load a single Person object,
* by Email Index(es)
* @param string $strEmail
* @return Person
*/
public static function LoadByEmail($strEmail)
{
return Person::QuerySingle(QQ::Equal(QQN::Person()->Email, $strEmail));
}
示例7: testNullArray
public function testNullArray()
{
$arrPeople = Person::QuerySingle(QQ::Equal(QQN::Person()->Id, 2));
$this->assertTrue(is_null($arrPeople->_ProjectAsManagerArray), "_ProjectAsManagerArray is null");
}
示例8: testTypeExpansion
public function testTypeExpansion()
{
$clauses = QQ::Clause(QQ::ExpandAsArray(QQN::Person()->PersonType));
$objPerson = Person::QuerySingle(QQ::Equal(QQN::Person()->Id, 7), $clauses);
$intPersonTypeArray = $objPerson->_PersonTypeArray;
$this->assertEqual($intPersonTypeArray, array(PersonType::Manager, PersonType::CompanyCar), "PersonType expansion is correct");
}
示例9: LoadByUsername
/**
* Load a single Person object,
* by Username Index(es)
* @param string $strUsername
* @return Person
*/
public static function LoadByUsername($strUsername)
{
return Person::QuerySingle(QQ::Equal(QQN::Person()->Username, $strUsername));
}