src/db/orm/meta/PropertyMapping.php
public function convertToDBValue($value, IConnector $connector) {
        if ($value === null) {
            $value = 'null';
        }
        else {
            $type = $this->mapping['type'];
            switch ($type) {
                case 'bool'   :
                case 'boolean': $value = $connector->escapeLiteral((bool) $value); break;

                case 'int'    :
                case 'integer': $value = (string)(int) $value; break;

                case 'real'   :
                case 'float'  :
                case 'double' : $value = (string)(float) $value; break;

                case 'string' : $value = $connector->escapeLiteral((string) $value); break;

                default:
                    if (is_class($type)) {
                        $value = (new $type())->convertToDBValue($value, $this, $connector);
                        break;
                    }
                    throw new RuntimeException('Unsupported type "'.$type.'" for database mapping of '.$this->entityMapping->getClassName().'::'.$this->getName());
            }
        }
        return $value;
    }
public function convertToDBValue($value, IConnector $connector) {
        if ($value === null) {
            $value = 'null';
        }
        else {
            $type = $this->mapping['type'];
            switch ($type) {
                case 'bool'   :
                case 'boolean': $value = $connector->escapeLiteral((bool) $value); break;

                case 'int'    :
                case 'integer': $value = (string)(int) $value; break;

                case 'real'   :
                case 'float'  :
                case 'double' : $value = (string)(float) $value; break;

                case 'string' : $value = $connector->escapeLiteral((string) $value); break;

                default:
                    if (is_class($type)) {
                        $value = (new $type())->convertToDBValue($value, $this, $connector);
                        break;
                    }
                    throw new RuntimeException('Unsupported type "'.$type.'" for database mapping of '.$this->entityMapping->getClassName().'::'.$this->getName());
            }
        }
        return $value;
    }
public function convertToDBValue ( $ value , IConnector $ connector ) { if ( $ value === null ) { $ value = 'null' ; } else { $ type = $ this -> mapping [ 'type' ] ; switch ( $ type ) { case 'bool' : case 'boolean' : $ value = $ connector -> escapeLiteral ( ( bool ) $ value ) ; break ; case 'int' : case 'integer' : $ value = ( string ) ( int ) $ value ; break ; case 'real' : case 'float' : case 'double' : $ value = ( string ) ( float ) $ value ; break ; case 'string' : $ value = $ connector -> escapeLiteral ( ( string ) $ value ) ; break ; default : if ( is_class ( $ type ) ) { $ value = ( new $ type ( ) ) -> convertToDBValue ( $ value , $ this , $ connector ) ; break ; } throw new RuntimeException ( 'Unsupported type "' . $ type . '" for database mapping of ' . $ this -> entityMapping -> getClassName ( ) . '::' . $ this -> getName ( ) ) ; } } return $ value ; }
Convert a PHP value to its SQL representation.

@param  mixed      $value     - PHP representation of a property value
@param  IConnector $connector - the used database connector

@return string - database representation
Convert a PHP value to its SQL representation .