本文整理汇总了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));
}