protected function SelectQuery(QueryBuilder $QueryBuilder, Relational\Request $Request) { $QueryBuilder->Append('SELECT '); foreach ($QueryBuilder->Delimit($Request->GetColumns(), ',') as $Column) { $QueryBuilder->AppendExpression(Expression::ReviveColumn($Column)); $QueryBuilder->AppendIdentifier(' AS #', [$Column->GetIdentifier()]); } $QueryBuilder->AppendIdentifiers(' FROM # ', array_keys($Request->GetTables()), ', '); $this->AppendCriterion($QueryBuilder, $Request->GetCriterion()); }
public function AddParentPredicateToRequest(Relational\Request $Request, array $ParentRows) { $ParentTable = $this->GetParentTable(); if ($ParentTable) { $Request->AddTable($ParentTable); } $Request->AddColumns($this->GetReferencedColumns()); $MatchExpressions = []; foreach ($ParentRows as $ParentRow) { $ReferencedKey = $this->MapParentRowToRelatedKey($this->ForeignKey, $ParentRow); $MatchExpressions[] = new Expressions\MatchesColumnDataExpression($ReferencedKey); } $Request->GetCriterion()->AddPredicateExpression(Expressions\Expression::CompoundBoolean($MatchExpressions, Expressions\Operators\Binary::LogicalOr)); }