public function prepareAttributeValue($mapping, $value)
    {
        if ($value === null) {
            return Type::getNull();
        }

        $type = $mapping !== null ? $mapping->getType() : TypeFactory::getTypeFromPHPVariable($value);

        if (is_array($value)) {
            $value = array_map(
                function ($v) {
                    $this->prepareAttributeValue(null, $v);
                },
                $value
            );
        }

        return $type->convertToDatabaseValue($value);
    }
public function prepareAttributeValue($mapping, $value)
    {
        if ($value === null) {
            return Type::getNull();
        }

        $type = $mapping !== null ? $mapping->getType() : TypeFactory::getTypeFromPHPVariable($value);

        if (is_array($value)) {
            $value = array_map(
                function ($v) {
                    $this->prepareAttributeValue(null, $v);
                },
                $value
            );
        }

        return $type->convertToDatabaseValue($value);
    }
public function prepareAttributeValue ( $ mapping , $ value ) { if ( $ value === null ) { return Type :: getNull ( ) ; } $ type = $ mapping !== null ? $ mapping -> getType ( ) : TypeFactory :: getTypeFromPHPVariable ( $ value ) ; if ( is_array ( $ value ) ) { $ value = array_map ( function ( $ v ) { $ this -> prepareAttributeValue ( null , $ v ) ; } , $ value ) ; } return $ type -> convertToDatabaseValue ( $ value ) ; }
Prepares a non-associated attribute value.

@param PropertyMetadata|null $mapping
@param mixed                 $value

@return array
Prepares a non - associated attribute value .