Compare commits

..

3 Commits

Author SHA1 Message Date
Dave Mc Nicoll
2de3139c80 - Added description to most attributes 2024-05-27 18:09:22 +00:00
Dave Mc Nicoll
e37eeb85f1 Merge branch 'master' into notes-2.x 2024-05-21 14:01:50 +00:00
Dave Mc Nicoll
7de0ecb028 - Fixed SearchLike attribute 2024-05-21 13:00:19 +00:00
33 changed files with 50 additions and 10 deletions

View File

@ -10,6 +10,7 @@ class Table implements AdapterAttributeInterface {
public ? string $schema = null,
public ? string $adapter = null,
public ? string $engine = null,
public string $description = "",
) {}
public function adapter() : false|string

View File

@ -14,5 +14,6 @@ class Field {
public mixed $default = null,
public bool $readonly = false,
public null|int $decimal = null,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Bigint extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Bit extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Blob extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -13,5 +13,6 @@ class CreatedAt extends \Ulmus\Attribute\Property\Field {
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -11,5 +11,6 @@ class Date extends \Ulmus\Attribute\Property\Field {
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -11,5 +11,6 @@ class Datetime extends \Ulmus\Attribute\Property\Field {
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Decimal extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Float extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -26,6 +26,7 @@ class ForeignKey extends PrimaryKey {
public null|string $relation = null,
public ConstrainActionEnum $onDelete = ConstrainActionEnum::NoAction,
public ConstrainActionEnum $onUpdate = ConstrainActionEnum::NoAction,
public string $description = "",
) {
#$this->references = Attribute::handleArrayField($this->references, false);
}

View File

@ -17,5 +17,6 @@ class Id extends \Ulmus\Attribute\Property\Field {
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Longblob extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Longtext extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Mediumblob extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Mediumint extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Mediumtext extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Numeric extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -16,5 +16,6 @@ class PrimaryKey extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Smallint extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Text extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -5,8 +5,13 @@ namespace Ulmus\Attribute\Property\Field;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Time extends \Ulmus\Attribute\Property\Field
{
public function __construct(? string $type = "time", ? int $length = null)
{
parent::__construct($type, $length);
}
public function __construct(
public ? string $name = null,
public ? string $type = "time",
public array $attributes = [],
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -5,8 +5,13 @@ namespace Ulmus\Attribute\Property\Field;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Timestamp extends \Ulmus\Attribute\Property\Field
{
public function __construct(? string $type = "timestamp", ? int $length = null)
{
parent::__construct($type, $length);
}
public function __construct(
public ? string $name = null,
public ? string $type = "timestamp",
public array $attributes = [],
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Blob extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Tinyint extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -14,5 +14,6 @@ class Tinytext extends \Ulmus\Attribute\Property\Field
public bool $nullable = false,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -15,5 +15,6 @@ class UpdatedAt extends \Ulmus\Attribute\Property\Field
public bool $nullable = true,
public mixed $default = null,
public bool $readonly = false,
public string $description = "",
) {}
}

View File

@ -9,5 +9,6 @@ class SearchGroupBy extends SearchParameter
{
public function __construct(
public null|string|\Stringable|array $field = null,
public string $description = "",
) {}
}

View File

@ -12,5 +12,6 @@ class SearchLike extends SearchParameter
public null|string|\Stringable|array $field = null,
public bool $toggle = false,
public SearchMethodEnum $method = SearchMethodEnum::Like,
public string $description = "",
) {}
}

View File

@ -15,5 +15,6 @@ class SearchOrderBy extends SearchParameter
public ? string $parameter = null,
public null|string|\Stringable|array $field = null,
public null|SearchMethodEnum $order = null,
public string $description = "",
) {}
}

View File

@ -10,5 +10,6 @@ class SearchRequestParameter
public function __construct(
public string $class,
public ? string $alias = null,
public string $description = "",
) {}
}

View File

@ -12,5 +12,6 @@ class SearchWhere extends SearchParameter
public null|string|\Stringable|array $field = null,
public bool $toggle = false,
public SearchMethodEnum $method = SearchMethodEnum::Where,
public string $description = "",
) {}
}

View File

@ -4,7 +4,7 @@ namespace Ulmus\SearchRequest;
use Psr\Http\Message\ServerRequestInterface;
use Ulmus\SearchRequest\Attribute\{ SearchParameter, SearchWhere, SearchOrderBy, SearchGroupBy, SearchRequestParameter, };
use Ulmus\SearchRequest\Attribute\{ SearchParameter, SearchWhere, SearchLike, SearchOrderBy, SearchGroupBy, SearchRequestParameter, };
trait SearchRequestFromRequestTrait
{
@ -53,7 +53,7 @@ trait SearchRequestFromRequestTrait
$value = $queryParams->offsetExists($queryParamName) ? $this->transformValue($attributeList, $queryParams[$queryParamName]) : null;
if ($attribute instanceof SearchWhere) {
if ($attribute instanceof SearchWhere || $attribute instanceof SearchLike) {
if ($attribute->toggle) {
$this->$propertyName = $queryParams->offsetExists($queryParamName);
}