public function typecastLoadField(Field $f, $value)
    {
        try {
            // use $f->typecast = [typecast_save_callback, typecast_load_callback]
            if (is_array($f->typecast) && isset($f->typecast[1]) && is_callable($t = $f->typecast[1])) {
                return $t($value, $f, $this);
            }

            // only string type fields can use empty string as legit value, for all
            // other field types empty value is the same as no-value, nothing or null
            if ($f->type && $f->type != 'string' && $value === '') {
                return;
            }

            // we respect null values
            if ($value === null) {
                return;
            }

            // run persistence-specific typecasting of field value
            return $this->_typecastLoadField($f, $value);
        } catch (\Exception $e) {
            throw new Exception(['Unable to typecast field value on load', 'field' => $f->name], null, $e);
        }
    }
public function typecastLoadField(Field $f, $value)
    {
        try {
            // use $f->typecast = [typecast_save_callback, typecast_load_callback]
            if (is_array($f->typecast) && isset($f->typecast[1]) && is_callable($t = $f->typecast[1])) {
                return $t($value, $f, $this);
            }

            // only string type fields can use empty string as legit value, for all
            // other field types empty value is the same as no-value, nothing or null
            if ($f->type && $f->type != 'string' && $value === '') {
                return;
            }

            // we respect null values
            if ($value === null) {
                return;
            }

            // run persistence-specific typecasting of field value
            return $this->_typecastLoadField($f, $value);
        } catch (\Exception $e) {
            throw new Exception(['Unable to typecast field value on load', 'field' => $f->name], null, $e);
        }
    }
public function typecastLoadField ( Field $ f , $ value ) { try { // use $f->typecast = [typecast_save_callback, typecast_load_callback] if ( is_array ( $ f -> typecast ) && isset ( $ f -> typecast [ 1 ] ) && is_callable ( $ t = $ f -> typecast [ 1 ] ) ) { return $ t ( $ value , $ f , $ this ) ; } // only string type fields can use empty string as legit value, for all // other field types empty value is the same as no-value, nothing or null if ( $ f -> type && $ f -> type != 'string' && $ value === '' ) { return ; } // we respect null values if ( $ value === null ) { return ; } // run persistence-specific typecasting of field value return $ this -> _typecastLoadField ( $ f , $ value ) ; } catch ( \ Exception $ e ) { throw new Exception ( [ 'Unable to typecast field value on load' , 'field' => $ f -> name ] , null , $ e ) ; } }
Cast specific field value from the way how it's stored inside
persistence to a PHP format.

@param Field $f
@param mixed $value

@return mixed
Cast specific field value from the way how it s stored inside persistence to a PHP format .