See the json
{
"field": "ur.entity_type",
"operator": "=",
"value": "product"
}
and the PHP classes:
class Filter
{
public function __construct(
#[\Crell\Serde\Attributes\Field(flatten: true)]
public ValidatedString $field,
public string $operator,// todo: move to enum
public string $value,
) {
}
}
class ValidatedString
{
protected const ALLOWED_PATTERN = '/^[a-z.]+$/';
public function __construct(
public string $value
) {}
#[\Crell\Serde\Attributes\PostLoad]
protected function validate(): void
{
if (!preg_match(self::ALLOWED_PATTERN, $this->value)) {
throw new \InvalidArgumentException(
sprintf(
'Invalid text "%s". Only lowercase letters (a-z) and dots (.) are allowed.',
$this->value
)
);
}
}
}
Due to both these objects having the property of value It fails around here src/PropertyHandler/ObjectImporter.php::103 where you're passing in $remaining, and later on you get the error "Warning: Undefined array key "value" in /var/www/html/vendor/crell/serde/src/PropertyHandler/ObjectImporter.php on line 70"
See the json
{ "field": "ur.entity_type", "operator": "=", "value": "product" }and the PHP classes:
Due to both these objects having the property of
valueIt fails around here src/PropertyHandler/ObjectImporter.php::103 where you're passing in$remaining, and later on you get the error"Warning: Undefined array key "value" in /var/www/html/vendor/crell/serde/src/PropertyHandler/ObjectImporter.php on line 70"