composer update + SQL Compare refactored
This commit is contained in:
9
Core/Driver/SQL/Join/InnerJoin.class.php
Normal file
9
Core/Driver/SQL/Join/InnerJoin.class.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Join;
|
||||
|
||||
class InnerJoin extends Join {
|
||||
public function __construct(string $table, string $columnA, string $columnB, ?string $tableAlias = null, array $conditions = []) {
|
||||
parent::__construct("INNER", $table, $columnA, $columnB, $tableAlias, $conditions);
|
||||
}
|
||||
}
|
||||
34
Core/Driver/SQL/Join/Join.class.php
Normal file
34
Core/Driver/SQL/Join/Join.class.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Join;
|
||||
|
||||
use Core\Driver\SQL\Column\Column;
|
||||
use Core\Driver\SQL\Condition\Compare;
|
||||
|
||||
class Join {
|
||||
|
||||
private string $type;
|
||||
private string $table;
|
||||
private string $columnA;
|
||||
private string $columnB;
|
||||
private ?string $tableAlias;
|
||||
private array $conditions;
|
||||
|
||||
public function __construct(string $type, string $table, string $columnA, string $columnB, ?string $tableAlias = null, array $conditions = []) {
|
||||
$this->type = $type;
|
||||
$this->table = $table;
|
||||
$this->columnA = $columnA;
|
||||
$this->columnB = $columnB;
|
||||
$this->tableAlias = $tableAlias;
|
||||
$this->conditions = $conditions;
|
||||
array_unshift($this->conditions , new Compare($columnA, new Column($columnB), "="));
|
||||
}
|
||||
|
||||
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; }
|
||||
public function getConditions(): array { return $this->conditions; }
|
||||
|
||||
}
|
||||
9
Core/Driver/SQL/Join/LeftJoin.class.php
Normal file
9
Core/Driver/SQL/Join/LeftJoin.class.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Core\Driver\SQL\Join;
|
||||
|
||||
class LeftJoin extends Join {
|
||||
public function __construct(string $table, string $columnA, string $columnB, ?string $tableAlias = null, array $conditions = []) {
|
||||
parent::__construct("LEFT", $table, $columnA, $columnB, $tableAlias, $conditions);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user