- Added a new MsSQL adapter
- Some bugfixes were made within annotations. - Added a new Object Instanciator which allows to manipulate and define how an object from an entity must be instanciated with given value.
This commit is contained in:
1 parent
9df7e65dcf
commit
5bd60129ea
22 files changed
+547
-103
No files matched your search
+13
-15
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace Ulmus;
|
||||
|
||||
|
||||
class QueryBuilder
|
||||
{
|
||||
|
||||
public Query\Where $where;
|
||||
|
||||
/**
|
||||
@@ -14,20 +12,14 @@ class QueryBuilder
|
||||
public array $parameters = [];
|
||||
|
||||
public string $conditionOperator = Query\Where::CONDITION_AND;
|
||||
|
||||
public string $entityClass;
|
||||
|
||||
|
||||
protected int $parameterIndex = 0;
|
||||
|
||||
protected array $queryStack = [];
|
||||
|
||||
public function __construct($entityClass = "") {
|
||||
$this->entityClass = $entityClass;
|
||||
}
|
||||
|
||||
public function select($field) : self
|
||||
{
|
||||
if ( $select = $this->has(Query\Select::class) ) {
|
||||
if ( false !== ( $select = $this->has(Query\Select::class) ) ) {
|
||||
$select->add($field);
|
||||
}
|
||||
else {
|
||||
@@ -52,17 +44,23 @@ class QueryBuilder
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function from($table, $alias = null, $database = null) : self
|
||||
public function from(string $table, ? string $alias = null, ? string $database = null, ? string $schema = null) : self
|
||||
{
|
||||
$table = "\"$table\"";
|
||||
|
||||
if ( $database ) {
|
||||
$table = "`$database`.".$table;
|
||||
$table = "\"$database\".$table";
|
||||
}
|
||||
|
||||
if ( $schema ) {
|
||||
$table = "\"$schema\".$table";
|
||||
}
|
||||
|
||||
if ( $from = $this->has(Query\From::class) ) {
|
||||
if ( false !== ( $from = $this->has(Query\From::class) ) ) {
|
||||
$from->add($alias ? [ $alias => $table ] : $table);
|
||||
}
|
||||
else {
|
||||
$from = new Query\From();
|
||||
$from = new Query\From($this);
|
||||
$this->push($from);
|
||||
$from->set($alias ? [ $alias => $table ] : $table);
|
||||
}
|
||||
@@ -94,7 +92,7 @@ class QueryBuilder
|
||||
if ( $this->where ?? false ) {
|
||||
$where = $this->where;
|
||||
}
|
||||
elseif ( false === $where = $this->has(Query\Where::class) ) {
|
||||
elseif ( false === ( $where = $this->has(Query\Where::class) ) ) {
|
||||
$this->where = $where = new Query\Where($this);
|
||||
$this->push($where);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user