- Added a MssqlRepository
- Adapter some code to allow more flexibility for the new LDAP adapter from ulmus-ldap. - Insert's fields are now escaped by default. - A new RelationBuilder was added, a lot of code from the EntityTrait was moved into this. Some code from the Repository class will need to be moved there too.
This commit is contained in:
1 parent
8f9332fbad
commit
16c6eb57fb
32 files changed
+641
-243
No files matched your search
@@ -5,7 +5,6 @@ namespace Ulmus\Query;
|
||||
use Ulmus\Annotation,
|
||||
Ulmus\Common\EntityField;
|
||||
|
||||
|
||||
class Create extends Fragment {
|
||||
|
||||
const SQL_TOKEN = "CREATE TABLE";
|
||||
|
||||
@@ -6,7 +6,7 @@ abstract class Fragment {
|
||||
|
||||
public int $order = 0;
|
||||
|
||||
public abstract function render() : string;
|
||||
public abstract function render() /*: mixed*/;
|
||||
|
||||
protected function renderSegments(array $segments, string $glue = " ") : string
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ class GroupBy extends Fragment {
|
||||
|
||||
public function set(array $order) : self
|
||||
{
|
||||
$this->groupBy = [ $order ];
|
||||
$this->groupBy = [ $order ];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ class Having extends Fragment {
|
||||
|
||||
public array $conditionList;
|
||||
|
||||
public QueryBuilder $queryBuilder;
|
||||
public QueryBuilderInterface $queryBuilder;
|
||||
|
||||
public ? Having $parent = null;
|
||||
|
||||
public string $condition = Where::CONDITION_AND;
|
||||
|
||||
public function __construct(? QueryBuilder $queryBuilder, $condition = Where::CONDITION_AND)
|
||||
public function __construct(? QueryBuilderInterface $queryBuilder, $condition = Where::CONDITION_AND)
|
||||
{
|
||||
$this->queryBuilder = $queryBuilder;
|
||||
$this->condition = $condition;
|
||||
@@ -70,11 +70,11 @@ class Having extends Fragment {
|
||||
public string $field;
|
||||
public string $operator;
|
||||
public string $condition;
|
||||
public QueryBuilder $queryBuilder;
|
||||
public QueryBuilderInterface $queryBuilder;
|
||||
|
||||
protected string $content = "";
|
||||
|
||||
public function __construct(QueryBuilder $queryBuilder, string $field, $value, string $operator, string $condition, bool $not) {
|
||||
public function __construct(QueryBuilderInterface $queryBuilder, string $field, $value, string $operator, string $condition, bool $not) {
|
||||
$this->queryBuilder = $queryBuilder;
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class Join extends Fragment
|
||||
|
||||
public int $order = 40;
|
||||
|
||||
public function __construct(QueryBuilder $queryBuilder)
|
||||
public function __construct(QueryBuilderInterface $queryBuilder)
|
||||
{
|
||||
$this->queryBuilder = new QueryBuilder();
|
||||
$this->queryBuilder->parent = $queryBuilder;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Query;
|
||||
|
||||
interface QueryBuilderInterface
|
||||
{
|
||||
public function push(Fragment $queryFragment) : self;
|
||||
public function pull(Fragment $queryFragment) : self;
|
||||
public function render(bool $skipToken = false) /* mixed */;
|
||||
public function reset() : void;
|
||||
public function getFragment(string $class, int $index = 0) : ? Fragment;
|
||||
public function removeFragment(Fragment $fragment) : void;
|
||||
}
|
||||
+2
-2
@@ -10,9 +10,9 @@ class Set extends Fragment {
|
||||
|
||||
public array $dataset;
|
||||
|
||||
public QueryBuilder $queryBuilder;
|
||||
public QueryBuilderInterface $queryBuilder;
|
||||
|
||||
public function __construct(QueryBuilder $queryBuilder)
|
||||
public function __construct(QueryBuilderInterface $queryBuilder)
|
||||
{
|
||||
$this->queryBuilder = $queryBuilder;
|
||||
}
|
||||
|
||||
+4
-6
@@ -2,8 +2,6 @@
|
||||
|
||||
namespace Ulmus\Query;
|
||||
|
||||
use Ulmus\QueryBuilder;
|
||||
|
||||
use Ulmus\Common\EntityField,
|
||||
Ulmus\Common\Sql;
|
||||
|
||||
@@ -24,13 +22,13 @@ class Where extends Fragment {
|
||||
|
||||
public array $conditionList;
|
||||
|
||||
public QueryBuilder $queryBuilder;
|
||||
public QueryBuilderInterface $queryBuilder;
|
||||
|
||||
public ? Where $parent = null;
|
||||
|
||||
public string $condition = self::CONDITION_AND;
|
||||
|
||||
public function __construct(? QueryBuilder $queryBuilder, $condition = self::CONDITION_AND)
|
||||
public function __construct(? QueryBuilderInterface $queryBuilder, $condition = self::CONDITION_AND)
|
||||
{
|
||||
$this->queryBuilder = $queryBuilder;
|
||||
$this->condition = $condition;
|
||||
@@ -80,11 +78,11 @@ class Where extends Fragment {
|
||||
public string $field;
|
||||
public string $operator;
|
||||
public string $condition;
|
||||
public QueryBuilder $queryBuilder;
|
||||
public QueryBuilderInterface $queryBuilder;
|
||||
|
||||
protected string $content = "";
|
||||
|
||||
public function __construct(QueryBuilder $queryBuilder, string $field, $value, string $operator, string $condition, bool $not) {
|
||||
public function __construct(QueryBuilderInterface $queryBuilder, string $field, $value, string $operator, string $condition, bool $not) {
|
||||
$this->queryBuilder = $queryBuilder;
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
|
||||
Reference in new issue
Block a user