- Merge with Mssql repository bugfix
This commit is contained in:
1 parent
724ab250ab
commit
e1990e7cc0
11 files changed
+95
-87
No files matched your search
@@ -7,6 +7,11 @@ use Ulmus\Annotation\Property\Field;
|
||||
|
||||
trait EscapeTrait
|
||||
{
|
||||
public function escapeIdentifier(string $identifier) : string
|
||||
{
|
||||
return $this->escapeField($identifier);
|
||||
}
|
||||
|
||||
public function escapeField(string $identifier) : string
|
||||
{
|
||||
return $this->adapter->adapter()->escapeIdentifier($identifier, Adapter\AdapterInterface::IDENTIFIER_FIELD);
|
||||
|
||||
@@ -5,66 +5,11 @@ namespace Ulmus\Repository;
|
||||
use Ulmus\{Repository, Query, Ulmus, Common};
|
||||
|
||||
class MssqlRepository extends Repository {
|
||||
/*
|
||||
protected function finalizeQuery() : void
|
||||
{
|
||||
if ( null !== $offset = $this->queryBuilder->getFragment(Query\Offset::class) ) {
|
||||
if ( null === $limit = $this->queryBuilder->getFragment(Query\Limit::class) ) {
|
||||
throw new \Exception("Your offset query fragment is missing a LIMIT value.");
|
||||
}
|
||||
|
||||
# an order by is mandatory for mssql offset/limit
|
||||
if ( null === $order = $this->queryBuilder->getFragment(Query\OrderBy::class) ) {
|
||||
$this->orderBy("(SELECT 0)");
|
||||
}
|
||||
|
||||
$mssqlOffset = new \Ulmus\Query\MsSQL\Offset();
|
||||
|
||||
$mssqlOffset->set($offset->offset, $limit->limit);
|
||||
|
||||
$this->queryBuilder->removeFragment($offset);
|
||||
$this->queryBuilder->removeFragment($limit);
|
||||
|
||||
$this->queryBuilder->push($mssqlOffset);
|
||||
}
|
||||
elseif ( null !== $limit = $this->queryBuilder->getFragment(Query\Limit::class) ) {
|
||||
|
||||
if ( null !== $select = $this->queryBuilder->getFragment(Query\Select::class) ) {
|
||||
$select->top = $limit->limit;
|
||||
}
|
||||
elseif ( null !== $delete = $this->queryBuilder->getFragment(Query\Delete::class) ) {
|
||||
$delete->top = $limit->limit;
|
||||
}
|
||||
|
||||
$this->queryBuilder->removeFragment($limit);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
protected function finalizeQuery() : void
|
||||
{
|
||||
if ( null !== $offset = $this->queryBuilder->getFragment(Query\Offset::class) ) {
|
||||
# an order by is mandatory for mssql offset/limit
|
||||
if ( null === $order = $this->queryBuilder->getFragment(Query\OrderBy::class) ) {
|
||||
$this->orderBy("(SELECT 0)");
|
||||
}
|
||||
|
||||
if ( empty ($offset->offset ) ) {
|
||||
if ( null !== $select = $this->queryBuilder->getFragment(Query\Select::class) ) {
|
||||
$select->top = $offset->limit;
|
||||
}
|
||||
elseif ( null !== $delete = $this->queryBuilder->getFragment(Query\Delete::class) ) {
|
||||
$delete->top = $offset->limit;
|
||||
}
|
||||
$this->queryBuilder->removeFragment($offset);
|
||||
}
|
||||
elseif ( empty($offset->limit) ) {
|
||||
throw new \Exception("Your offset query fragment is missing a LIMIT value.");
|
||||
}
|
||||
}
|
||||
|
||||
if ( null !== $limit = $this->queryBuilder->getFragment(Query\Limit::class) ) {
|
||||
$this->queryBuilder->removeFragment($limit);
|
||||
if ( null === $order = $this->queryBuilder->getFragment(Query\OrderBy::class) ) {
|
||||
$this->orderBy("(SELECT 0)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,9 +47,11 @@ class RelationBuilder
|
||||
|
||||
return $this->resolveRelation($name) ?: $this->resolveVirtual($name);
|
||||
}
|
||||
else {
|
||||
return $this->instanciateEmptyObject($name, $this->resolver->searchFieldAnnotation($name, new Relation() ));
|
||||
elseif ( $relation = $this->resolver->searchFieldAnnotation($name, new Relation() ) ) {
|
||||
return $this->instanciateEmptyObject($name, $relation);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function resolveVirtual(string $name) /* : bool|object|EntityCollection */
|
||||
|
||||
Reference in new issue
Block a user