src/Phlexible/Bundle/ElementtypeBundle/Field/AbstractField.php
public function fromRaw($value)
    {
        $type = $this->getDataType();

        if ($type === 'json') {
            $value = json_decode($value, true);
        } elseif ($type === 'array') {
            $value = (array) $value;
        } elseif ($type === 'list') {
            $value = explode(',', $value);
        } elseif ($type === 'boolean') {
            $value = $value ? '1' : '0';
        } elseif ($type === 'integer') {
            if (strlen($value)) {
                $value = (int) $value;
            } else {
                $value = null;
            }
        } elseif ($type === 'float') {
            if (strlen($value)) {
                $value = (float) $value;
            } else {
                $value = null;
            }
        }

        return $value;
    }
public function fromRaw($value)
    {
        $type = $this->getDataType();

        if ($type === 'json') {
            $value = json_decode($value, true);
        } elseif ($type === 'array') {
            $value = (array) $value;
        } elseif ($type === 'list') {
            $value = explode(',', $value);
        } elseif ($type === 'boolean') {
            $value = $value ? '1' : '0';
        } elseif ($type === 'integer') {
            if (strlen($value)) {
                $value = (int) $value;
            } else {
                $value = null;
            }
        } elseif ($type === 'float') {
            if (strlen($value)) {
                $value = (float) $value;
            } else {
                $value = null;
            }
        }

        return $value;
    }
public function fromRaw ( $ value ) { $ type = $ this -> getDataType ( ) ; if ( $ type === 'json' ) { $ value = json_decode ( $ value , true ) ; } elseif ( $ type === 'array' ) { $ value = ( array ) $ value ; } elseif ( $ type === 'list' ) { $ value = explode ( ',' , $ value ) ; } elseif ( $ type === 'boolean' ) { $ value = $ value ? '1' : '0' ; } elseif ( $ type === 'integer' ) { if ( strlen ( $ value ) ) { $ value = ( int ) $ value ; } else { $ value = null ; } } elseif ( $ type === 'float' ) { if ( strlen ( $ value ) ) { $ value = ( float ) $ value ; } else { $ value = null ; } } return $ value ; }
From submitted value to object.

@param string $value

@return mixed
From submitted value to object .