- Fixed Entity::field("propertyname") function to look for name into @Field() annotation and returns it if it exists. - A lot of bug fixes made into SQL fragments.
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Ulmus\Query;
|
|
|
|
use Ulmus\QueryBuilder;
|
|
|
|
class Join extends Fragment {
|
|
|
|
const SQL_TOKEN = "JOIN";
|
|
|
|
const TYPE_LEFT = "LEFT";
|
|
const TYPE_RIGHT = "RIGHT";
|
|
const TYPE_INNER = "INNER";
|
|
const TYPE_FULL = "FULL";
|
|
const TYPE_CROSS = "CROSS";
|
|
const TYPE_NATURAL = "NATURAL";
|
|
|
|
public bool $outer = false;
|
|
|
|
public array $joins = [];
|
|
|
|
public string $attachment = "ON";
|
|
|
|
public string $side;
|
|
|
|
public /*string|QueryBuilder*/ $table;
|
|
|
|
public string $field;
|
|
|
|
public /*string|QueryBuilder*/ $value;
|
|
|
|
public /* QueryBuilder */ $queryBuilder;
|
|
|
|
public function __construct(QueryBuilder $queryBuilder) {
|
|
$this->queryBuilder = $queryBuilder;
|
|
}
|
|
|
|
public function set(string $side, /* QueryBuilder|string */ $table, string $field, /* QueryBuilder|string */ $value)
|
|
{
|
|
$this->side = $side;
|
|
$this->table = $table;
|
|
$this->field = $field;
|
|
$this->value = $value;
|
|
}
|
|
|
|
public function render() : string
|
|
{
|
|
return $this->renderSegments([ $this->side, static::SQL_TOKEN, $this->table, $this->attachment, $this->field, "=", $this->value ]);
|
|
}
|
|
}
|