/** Hours of this Employee with date >= $date
* uses SqlSpecs to support eventual joins for sorting
* @param date to select the hours by
* @return arrayn of hours
* @throws PntError
*/
function ($date='0000-00-00') {
Gen::includeClass('PntSqlFilter', 'pnt/db/query');
Gen::includeClass('Hours', $this->()); // query model needs its metadata
//create filter for employeeId = $this->('id')
$employeeIdFilter = PntSqlFilter::getInstance('Hours', 'employeeId', '=', $this->('id'));
//ceate a combifilter for ANDing a filter for date >= $date
$combiFilter = $employeeIdFilter->('date', '>=', $date);
//retieve peanuts using the query model
$clsDes = PntClassDescriptor::getInstance('Hours');
return $clsDes->($combiFilter); //if the spec is not a PntSqlSort, the default sort will be used
}
}
?>
|