web-base/Core/Driver/SQL/Join.class.php

34 lines
1.1 KiB
PHP
Raw Normal View History

2020-04-02 00:02:51 +02:00
<?php
2022-11-18 18:06:46 +01:00
namespace Core\Driver\SQL;
2020-04-02 00:02:51 +02:00
2022-11-18 18:06:46 +01:00
use Core\Driver\SQL\Column\Column;
use Core\Driver\SQL\Condition\Compare;
2022-02-20 16:53:26 +01:00
2020-04-02 00:02:51 +02:00
class Join {
2020-04-03 17:39:58 +02:00
private string $type;
private string $table;
private string $columnA;
private string $columnB;
2021-04-02 21:58:06 +02:00
private ?string $tableAlias;
2022-02-20 16:53:26 +01:00
private array $conditions;
2020-04-02 00:02:51 +02:00
2022-02-20 16:53:26 +01:00
public function __construct(string $type, string $table, string $columnA, string $columnB, ?string $tableAlias = null, array $conditions = []) {
2020-04-03 17:39:58 +02:00
$this->type = $type;
2020-04-02 00:02:51 +02:00
$this->table = $table;
$this->columnA = $columnA;
$this->columnB = $columnB;
2021-01-07 14:59:36 +01:00
$this->tableAlias = $tableAlias;
2022-02-20 16:53:26 +01:00
$this->conditions = $conditions;
array_unshift($this->conditions , new Compare($columnA, new Column($columnB), "="));
2020-04-02 00:02:51 +02:00
}
2021-04-02 21:58:06 +02:00
public function getType(): string { return $this->type; }
public function getTable(): string { return $this->table; }
public function getColumnA(): string { return $this->columnA; }
public function getColumnB(): string { return $this->columnB; }
public function getTableAlias(): ?string { return $this->tableAlias; }
2022-02-20 16:53:26 +01:00
public function getConditions(): array { return $this->conditions; }
2020-04-02 00:02:51 +02:00
2020-04-03 17:39:58 +02:00
}