- Array type can now be assign directly (not as json or serialized)\n- Fixed a bug within WHERE when open() and close() where called without a condition

This commit is contained in:
Dave M. 2020-10-06 17:46:34 +00:00
parent 538af38769
commit 5be0c8cc01
2 changed files with 8 additions and 3 deletions

View File

@ -207,10 +207,15 @@ trait EntityTrait {
$this->{$field['name']} = null;
}
elseif ( $field['type'] === 'array' ) {
$this->{$field['name']} = substr($value, 0, 1) === "a" ? unserialize($value) : json_decode($value, true);
if ( is_string($value)) {
$this->{$field['name']} = substr($value, 0, 1) === "a" ? unserialize($value) : json_decode($value, true);
}
elseif ( is_array($value) ) {
$this->{$field['name']} = $value;
}
}
elseif ( EntityField::isScalarType($field['type']) ) {
if ( $field['type'] === 'string' ) {
$annotation = $entityResolver->searchFieldAnnotation($field['name'], new Field() );

View File

@ -67,7 +67,7 @@ class Where extends Fragment {
}
return $this->renderSegments([
! $this->parent ? static::SQL_TOKEN : "",
! $this->parent && ! empty($this->conditionList) ? static::SQL_TOKEN : "",
implode(" ", $stack)
]);
}