protected function AppendCriterion(QueryBuilder $QueryBuilder, Relational\Criterion $Criterion) { if ($Criterion->IsConstrained()) { $QueryBuilder->Append('WHERE '); } $QueryBuilder->AppendCriterion($Criterion); }
public final function AppendCriterion(QueryBuilder $QueryBuilder, Relational\Criterion $Criterion) { if ($Criterion->IsConstrained()) { $this->AppendPredicateExpressions($QueryBuilder, $Criterion->GetPredicateExpressions()); } if ($Criterion->IsGrouped()) { $this->AppendGroupByExpressions($QueryBuilder, $Criterion->GetGroupByExpressions()); } if ($Criterion->IsOrdered()) { $this->AppendOrderByExpressions($QueryBuilder, $Criterion->GetOrderedExpressionsAscendingMap()); } if ($Criterion->IsRanged()) { $this->AppendRange($QueryBuilder, $Criterion->GetRangeOffset(), $Criterion->GetRangeAmount()); } }
/** * @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()); } }
/** * {@inheritDoc} */ public final function GetCriterion() { $RelationalCriterion = new Relational\Criterion(); $RelationalCriterion->AddTables($this->GetMappedReviveTables()); $this->RelationalCriterion($RelationalCriterion); return $RelationalCriterion; }