Example #1
0
// Let's define our Project SubClass
// Note: Typically, this code would be in includes/data_objects/Project.class.php
// but the Project.class.php code has been pulled out and put here for demonstration
// purposes.
require __DATAGEN_CLASSES__ . '/ProjectGen.class.php';
class Project extends ProjectGen
{
    // Create our Custom Load Method
    // Note that this custom load method is based on the sample LoadArrayBySample that is generated
    // in the Project custom subclass.  Because it utilizes the Qcodo Query mechanism,
    // we can easily take full advantage of any QQ Clauses by taking it in as an optional parameter.
    public static function LoadArrayByBudgetMinimum($fltBudgetMinimum, $objOptionalClauses = null)
    {
        return Project::QueryArray(QQ::GreaterOrEqual(QQN::Project()->Budget, $fltBudgetMinimum), $objOptionalClauses);
    }
}
?>



	<h3>Load an Array of Projects Where the Budget >= $8,000</h3>
<?php 
// Let's load all Projects > $10,000 in budget
$objProjectArray = Project::LoadArrayByBudgetMinimum(8000);
foreach ($objProjectArray as $objProject) {
    _p('&bull; ' . QApplication::HtmlEntities($objProject->Name) . ' (Budget: $' . QApplication::HtmlEntities($objProject->Budget) . ')<br/>', false);
}
?>

<?php 
require __INCLUDES__ . '/examples/footer.inc.php';