- 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,8 +207,13 @@ trait EntityTrait {
$this->{$field['name']} = null; $this->{$field['name']} = null;
} }
elseif ( $field['type'] === 'array' ) { elseif ( $field['type'] === 'array' ) {
if ( is_string($value)) {
$this->{$field['name']} = substr($value, 0, 1) === "a" ? unserialize($value) : json_decode($value, true); $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']) ) { elseif ( EntityField::isScalarType($field['type']) ) {
if ( $field['type'] === 'string' ) { if ( $field['type'] === 'string' ) {

View File

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