src/Charcoal/Property/StorablePropertyTrait.php
public function storageVal($val)
    {
        if ($val === null) {
            // Do not json_encode NULL values
            return null;
        }

        if (!$this->l10n() && $val instanceof Translation) {
            $val = (string)$val;
        }

        if ($this->multiple()) {
            if (is_array($val)) {
                $val = implode($this->multipleSeparator(), $val);
            }
        }

        if (!is_scalar($val)) {
            return json_encode($val, JSON_UNESCAPED_UNICODE);
        }

        return $val;
    }
public function storageVal($val)
    {
        if ($val === null) {
            // Do not json_encode NULL values
            return null;
        }

        if (!$this->l10n() && $val instanceof Translation) {
            $val = (string)$val;
        }

        if ($this->multiple()) {
            if (is_array($val)) {
                $val = implode($this->multipleSeparator(), $val);
            }
        }

        if (!is_scalar($val)) {
            return json_encode($val, JSON_UNESCAPED_UNICODE);
        }

        return $val;
    }
public function storageVal ( $ val ) { if ( $ val === null ) { // Do not json_encode NULL values return null ; } if ( ! $ this -> l10n ( ) && $ val instanceof Translation ) { $ val = ( string ) $ val ; } if ( $ this -> multiple ( ) ) { if ( is_array ( $ val ) ) { $ val = implode ( $ this -> multipleSeparator ( ) , $ val ) ; } } if ( ! is_scalar ( $ val ) ) { return json_encode ( $ val , JSON_UNESCAPED_UNICODE ) ; } return $ val ; }
Retrieve the property's value in a format suitable for storage.

@param  mixed $val The value to convert for storage.
@return mixed
Retrieve the property s value in a format suitable for storage .