/**
* @access private
*
* Maps the supplied object criterion the the relational equivalent.
*
* @param IEntityRelationalMap $EntityRelationalMap The relational map of the object criterion
* @param Object\ICriterion $ObjectCriterion The object criterion to map
* @param Relational\Criterion $RelationalCriterion The relational criterion to map to
* @return void
*/
private function MapCriterion(IEntityRelationalMap $EntityRelationalMap, Object\ICriterion $ObjectCriterion, Relational\Criterion $RelationalCriterion)
{
if ($ObjectCriterion->IsConstrained()) {
foreach ($this->MapExpressions($EntityRelationalMap, $ObjectCriterion->GetPredicateExpressions()) as $PredicateExpression) {
$RelationalCriterion->AddPredicateExpression($PredicateExpression);
}
}
if ($ObjectCriterion->IsOrdered()) {
$ExpressionAscendingMap = $ObjectCriterion->GetOrderByExpressionsAscendingMap();
foreach ($ExpressionAscendingMap as $Expression) {
$IsAscending = $ExpressionAscendingMap[$Expression];
$Expressions = $this->MapExpression($EntityRelationalMap, $Expression);
foreach ($Expressions as $Expression) {
$RelationalCriterion->AddOrderByExpression($Expression, $IsAscending);
}
}
}
if ($ObjectCriterion->IsGrouped()) {
foreach ($this->MapExpressions($EntityRelationalMap, $ObjectCriterion->GetGroupByExpressions()) as $GroupByExpression) {
$RelationalCriterion->AddGroupByExpression($GroupByExpression);
}
}
if ($ObjectCriterion->IsRanged()) {
$RelationalCriterion->SetRangeOffset($ObjectCriterion->GetRangeOffset());
$RelationalCriterion->SetRangeAmount($ObjectCriterion->GetRangeAmount());
}
}