- WIP on search request handling of operators
This commit is contained in:
parent
2271b0b034
commit
cb125545c7
@ -47,7 +47,8 @@ class SqlFieldMapper
|
||||
break;
|
||||
|
||||
case "array":
|
||||
$this->type = "JSON";
|
||||
# Was set at JSON, but for now LONGTEXT is an alias of it (with additional constraints)
|
||||
$this->type = "LONGTEXT";
|
||||
break;
|
||||
|
||||
case "string":
|
||||
|
||||
14
src/Entity/Mariadb/Column.php
Normal file
14
src/Entity/Mariadb/Column.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Ulmus\Entity\Mariadb;
|
||||
|
||||
use Ulmus\Attribute\Property\Field;
|
||||
|
||||
class Column extends \Ulmus\Entity\Mysql\Column
|
||||
{
|
||||
#[Field\Id]
|
||||
public ? id $srs_id;
|
||||
|
||||
#[Field(name: "GENERATION_EXPRESSION", type: "longtext")]
|
||||
public ? string $generationExpression;
|
||||
}
|
||||
@ -6,8 +6,8 @@ use Ulmus\Attribute\Property\Field;
|
||||
|
||||
class Column extends \Ulmus\Entity\InformationSchema\Column
|
||||
{
|
||||
#[Field\Id]
|
||||
public ? id $srs_id;
|
||||
##[Field\Id]
|
||||
#public ? id $srs_id;
|
||||
|
||||
#[Field(name: "COLUMN_KEY", length: 3)]
|
||||
public string $key;
|
||||
@ -21,8 +21,8 @@ class Column extends \Ulmus\Entity\InformationSchema\Column
|
||||
#[Field(name: "COLUMN_COMMENT", length: 1024)]
|
||||
public string $comment;
|
||||
|
||||
#[Field(name: "GENERATION_EXPRESSION", type: "longtext")]
|
||||
public ? string $generationExpression;
|
||||
##[Field(name: "GENERATION_EXPRESSION", type: "longtext")]
|
||||
#public ? string $generationExpression;
|
||||
|
||||
# TODO ! Handle FUNCTIONAL default value
|
||||
protected function canHaveDefaultValue(): bool
|
||||
|
||||
@ -14,28 +14,4 @@ class SearchRequest implements SearchRequestInterface
|
||||
return $repository;
|
||||
}
|
||||
|
||||
public function wheres() : iterable
|
||||
{
|
||||
return array_filter($this->wheres + [
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function likes(): iterable
|
||||
{
|
||||
return array_filter($this->likes + [
|
||||
], 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 !== "" );
|
||||
}
|
||||
|
||||
}
|
||||
@ -199,6 +199,36 @@ trait SearchRequestFromRequestTrait
|
||||
return $this;
|
||||
}
|
||||
|
||||
/* [[ Boilerplates which are ready to be copied */
|
||||
public function wheres() : iterable
|
||||
{
|
||||
return array_filter($this->wheres + [
|
||||
|
||||
], fn($i) => ! is_null($i) ) + [ ];
|
||||
}
|
||||
|
||||
public function likes(): iterable
|
||||
{
|
||||
return array_filter($this->likes + [
|
||||
|
||||
], 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 !== "" );
|
||||
}
|
||||
/* ]] */
|
||||
|
||||
protected function getValueFromSource(RequestInterface $request, string $propertyName, SearchParameter $attribute) : mixed
|
||||
{
|
||||
$queryParamName = $attribute->getParameters() ?: [ $propertyName ];
|
||||
|
||||
@ -5,6 +5,16 @@ namespace Ulmus\SearchRequest;
|
||||
use Ulmus\Repository;
|
||||
|
||||
interface SearchRequestInterface {
|
||||
|
||||
/* HOW TO IMPLEMENT THIS !!? */
|
||||
public const SEARCH_REQUEST_OPERATORS = "searchRequest:operators";
|
||||
public const SEARCH_REQUEST_OPERATOR_EQUAL = "=";
|
||||
public const SEARCH_REQUEST_OPERATOR_NOT_EQUAL = "!=";
|
||||
public const SEARCH_REQUEST_OPERATOR_GREATER_THAN = ">";
|
||||
public const SEARCH_REQUEST_OPERATOR_GREATER_OR_EQUAL_THAN = ">=";
|
||||
public const SEARCH_REQUEST_OPERATOR_SMALLER_THAN = "<";
|
||||
public const SEARCH_REQUEST_OPERATOR_SMALLER_OR_EQUAL_THAN = "<=";
|
||||
|
||||
public function filter(Repository $repository) : Repository;
|
||||
|
||||
public function wheres() : iterable;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user