- Fixed 'value' for SearchRequestOrderBy and also fixed a typo where SearchManual would not be set

This commit is contained in:
Dave Mc Nicoll 2024-10-07 19:38:29 +00:00
parent 4106c8db91
commit 3ba8a2a5d0
2 changed files with 17 additions and 8 deletions

View File

@ -12,12 +12,20 @@ class Datetime extends \DateTime implements EntityObjectInterface {
{ {
$value = $arguments[0]; $value = $arguments[0];
# From Timestamp try {
if ( is_numeric($value) ) { # From Timestamp
return new static("@$value"); if ( is_numeric($value) ) {
$obj = new static("@$value");
}
else {
$obj = new static($value);
}
}
catch(\Throwable $ex) {
throw new \Exception(sprintf("An error occured trying to instanciate from '%s'. %s", $value, $ex->getMessage()), $ex->getCode(), $ex);
} }
return new static($value); return $obj;
} }
public function save() public function save()

View File

@ -60,6 +60,8 @@ trait SearchRequestFromRequestTrait
$field = $fieldName; $field = $fieldName;
} }
$value = $this->getValueFromSource($request, $propertyName, $attribute);
switch(true) { switch(true) {
case $attribute instanceof SearchGroupBy: case $attribute instanceof SearchGroupBy:
$this->parseAttributeGroupBy($attribute, $field, $propertyName); $this->parseAttributeGroupBy($attribute, $field, $propertyName);
@ -67,14 +69,13 @@ trait SearchRequestFromRequestTrait
case $attribute instanceof SearchWhere: case $attribute instanceof SearchWhere:
case $attribute instanceof SearchLike: case $attribute instanceof SearchLike:
case $attribute instanceof SearchManuel: case $attribute instanceof SearchManual:
$value = $this->getValueFromSource($request, $propertyName, $attribute);
if ($value !== null) { if ($value !== null) {
$value = $this->transformValue($property->getAttributes(Attribute\PropertyValueModifier::class), $value); $value = $this->transformValue($property->getAttributes(Attribute\PropertyValueModifier::class), $value);
} }
dump($value);
if ($attribute->toggle) { if ($attribute->toggle) {
$this->$propertyName = !empty($value); $this->$propertyName = !empty($value);
} elseif ($value !== null) { } elseif ($value !== null) {