- Work done on Join and using the @Relation annotation in case there is no join.

- Added some field type (date, Datetime, Time)
- Added a new @Filter annotation which allows to filter repository from relation into a method.
This commit is contained in:
mcndave committed 2021-01-26 16:48:40 +00:00
1 parent 65de1dd849
commit e465ecdf32
17 files changed
+197 -61

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ class Create extends Fragment {
public function renderFields() : string
{
return "(" . PHP_EOL . implode(",".PHP_EOL, array_map(function($field) {
return " ".EntityField::generateCreateColumn($field);
return " " . EntityField::generateCreateColumn($field);
}, $this->fieldList)) . PHP_EOL . ")";
}
}
+5 -7
View File
@@ -37,6 +37,8 @@ class Join extends Fragment
public /* QueryBuilder */ $queryBuilder;
public int $order = 40;
public function __construct(QueryBuilder $queryBuilder)
{
$this->queryBuilder = new QueryBuilder();
@@ -47,18 +49,14 @@ class Join extends Fragment
{
$this->side = $side;
$this->table = $table;
$this->field = $field;
$this->value = $value;
$this->where($this->field = $field, $this->value = $value);
}
public function render() : string
{
if ($this->queryBuilder->where ?? false ) {
$where = $this->renderSegments([Where::CONDITION_AND, $this->queryBuilder->render(true)]);
}
return $this->renderSegments([
strtoupper($this->side), $this->outer ? static::SQL_OUTER : "", static::SQL_TOKEN, $this->table, $this->alias ?? "", $this->attachment, $this->field, "=", $this->value, $where ?? ""
strtoupper($this->side), $this->outer ? static::SQL_OUTER : "", static::SQL_TOKEN, $this->table, $this->alias ?? "", $this->attachment, $this->queryBuilder->render(true) ?? ""
]);
}
}