diff --git a/src/Entity/Mssql/Table.php b/src/Entity/Mssql/Table.php index 991591d..d5a9a14 100644 --- a/src/Entity/Mssql/Table.php +++ b/src/Entity/Mssql/Table.php @@ -20,8 +20,9 @@ class Table extends \Ulmus\Entity\InformationSchema\Table $adapter = Ulmus::$registeredAdapters[$this->loadedFromAdapter]; return Column::repository(Repository\MssqlRepository::DEFAULT_ALIAS, $adapter) - ->where(Column::field('tableName'), $this->name ) - ->and(Column::field('tableSchema'), $this->schema ) + ->select('*') + ->where('TABLE_NAME', $this->name ) + ->and('TABLE_SCHEMA', $this->schema ) ->loadAll(); } } \ No newline at end of file diff --git a/src/SearchRequest/DeprecatedSearchRequestFormatTrait.php b/src/SearchRequest/DeprecatedSearchRequestFormatTrait.php new file mode 100644 index 0000000..35a808c --- /dev/null +++ b/src/SearchRequest/DeprecatedSearchRequestFormatTrait.php @@ -0,0 +1,107 @@ +wheres + [ + + ], fn($i) => ! is_null($i) ) + [ ]; + } + + public function wheresConditions() : iterable + { + return array_filter($this->wheresConditions + [ + + ], fn($i) => ! is_null($i) ) + [ ]; + } + + public function wheresOperators() : iterable + { + return array_filter($this->wheresOperators + [ + + ], fn($i) => ! is_null($i) ) + [ ]; + } + + public function likes(): iterable + { + return array_filter($this->likes + [ + + ], fn($i) => ! is_null($i) ) + []; + } + + public function likesConditions() : iterable + { + return array_filter($this->likesConditions + [ + + ], fn($i) => ! is_null($i) ) + [ ]; + } + + public function likesOperators() : iterable + { + return array_filter($this->likesOperators + [ + + ], fn($i) => ! is_null($i) ) + [ ]; + } + + public function groups(): iterable + { + return array_filter($this->groups + [ + + ], fn($e) => ! is_null($e) && $e !== "" ); + } + + public function orders(): iterable + { + return array_filter($this->orders + [ + + ], fn($e) => ! is_null($e) && $e !== "" ); + } + + public function applyCount(Repository\RepositoryInterface $repository): SearchRequestInterface + { + $this->count = $this->filter($repository) + ->wheres($this->wheres(), $this->wheresOperators(), $this->wheresConditions()) + ->likes($this->likes(), $this->likesConditions()) + ->groups($this->groups()) + ->count(); + + return $this; + } + + public function apply(Repository\RepositoryInterface $repository): SearchRequestInterface + { + $this->filter($repository) + ->wheres($this->wheres(), $this->wheresOperators(), $this->wheresConditions()) + ->likes($this->likes(), $this->likesConditions()) + ->orders($this->orders()) + ->groups($this->groups()) + ->offset($this->offset()) + ->limit($this->limit()); + + return $this; + } + /* ]] */ +} \ No newline at end of file diff --git a/src/SearchRequest/SearchRequestPaginationTrait.php b/src/SearchRequest/SearchRequestPaginationTrait.php index 9a0c85a..66016e5 100644 --- a/src/SearchRequest/SearchRequestPaginationTrait.php +++ b/src/SearchRequest/SearchRequestPaginationTrait.php @@ -5,6 +5,7 @@ namespace Ulmus\SearchRequest; use Ulmus\Repository; trait SearchRequestPaginationTrait { + use DeprecatedSearchRequestFormatTrait; public int $count = 0;