- Heavy rework on search request handling of entities

This commit is contained in:
Dev committed 2025-12-02 00:15:26 +00:00
1 parent cb125545c7
commit a9b9c2cce9
3 files changed
+77

No files matched your search

@@ -0,0 +1,9 @@
<?php
namespace Ulmus\SearchRequest\Attribute;
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::IS_REPEATABLE)]
abstract class FieldValueModifier
{
public abstract function run(mixed $field) : mixed;
}
@@ -0,0 +1,20 @@
<?php
namespace Ulmus\SearchRequest\Attribute\PropertyValueModifier;
use Ulmus\SearchRequest\Attribute\PropertyValueModifier;
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class Pad extends PropertyValueModifier
{
public function __construct(
public int $length,
public string $padWith,
public int $type = \STR_PAD_RIGHT,
) {}
public function run(mixed $value) : mixed
{
return str_pad($value, $this->length, $this->padWith, $this->type);
}
}