Private/Polyfony/Query/Convert.php
public static function valueFromDatabase($column_name, $raw_value, $get_it_raw=false) {

		// if we want the raw result ok, but exclude arrays that can never be gotten raw
		if($get_it_raw === true && substr($column_name,-6,6) != '_array') {
			// return as is
			$value = $raw_value;
		}
		// if the column_name contains an array
		elseif(substr($column_name,-6,6) == '_array') {
			// decode the array
			$value = json_decode($raw_value,true);
		}
		// if the column_name contains a size value
		elseif(substr($column_name,-5,5) == '_size') {
			// convert to human size
			$value = \Polyfony\Format::size($raw_value);
		}
		// if the column_name contains a datetime
		elseif(substr($column_name,-9,9) == '_datetime') {
			// if the value is set
			$value = date('d/m/Y H:i', $raw_value);
		}
		// if the column_name contains a date
		elseif(
			substr($column_name,-5,5) == '_date' || 
			substr($column_name,-3,3) == '_at' || 
			substr($column_name,-3,3) == '_on'
		) {
			// if the value is set
			$value = date('d/m/Y', $raw_value);
		}
		// not a magic column name
		else {
			// we secure it against XSS
			$value = \Polyfony\Format::htmlSafe($raw_value);
		}
		// return the converted (or not) value
		return $value;

	}
public static function valueFromDatabase($column_name, $raw_value, $get_it_raw=false) {

		// if we want the raw result ok, but exclude arrays that can never be gotten raw
		if($get_it_raw === true && substr($column_name,-6,6) != '_array') {
			// return as is
			$value = $raw_value;
		}
		// if the column_name contains an array
		elseif(substr($column_name,-6,6) == '_array') {
			// decode the array
			$value = json_decode($raw_value,true);
		}
		// if the column_name contains a size value
		elseif(substr($column_name,-5,5) == '_size') {
			// convert to human size
			$value = \Polyfony\Format::size($raw_value);
		}
		// if the column_name contains a datetime
		elseif(substr($column_name,-9,9) == '_datetime') {
			// if the value is set
			$value = date('d/m/Y H:i', $raw_value);
		}
		// if the column_name contains a date
		elseif(
			substr($column_name,-5,5) == '_date' || 
			substr($column_name,-3,3) == '_at' || 
			substr($column_name,-3,3) == '_on'
		) {
			// if the value is set
			$value = date('d/m/Y', $raw_value);
		}
		// not a magic column name
		else {
			// we secure it against XSS
			$value = \Polyfony\Format::htmlSafe($raw_value);
		}
		// return the converted (or not) value
		return $value;

	}
public static function valueFromDatabase ( $ column_name , $ raw_value , $ get_it_raw = false ) { // if we want the raw result ok, but exclude arrays that can never be gotten raw if ( $ get_it_raw === true && substr ( $ column_name , - 6 , 6 ) != '_array' ) { // return as is $ value = $ raw_value ; } // if the column_name contains an array elseif ( substr ( $ column_name , - 6 , 6 ) == '_array' ) { // decode the array $ value = json_decode ( $ raw_value , true ) ; } // if the column_name contains a size value elseif ( substr ( $ column_name , - 5 , 5 ) == '_size' ) { // convert to human size $ value = \ Polyfony \ Format :: size ( $ raw_value ) ; } // if the column_name contains a datetime elseif ( substr ( $ column_name , - 9 , 9 ) == '_datetime' ) { // if the value is set $ value = date ( 'd/m/Y H:i' , $ raw_value ) ; } // if the column_name contains a date elseif ( substr ( $ column_name , - 5 , 5 ) == '_date' || substr ( $ column_name , - 3 , 3 ) == '_at' || substr ( $ column_name , - 3 , 3 ) == '_on' ) { // if the value is set $ value = date ( 'd/m/Y' , $ raw_value ) ; } // not a magic column name else { // we secure it against XSS $ value = \ Polyfony \ Format :: htmlSafe ( $ raw_value ) ; } // return the converted (or not) value return $ value ; }
convert a value comming from the database, to its original type
convert a value comming from the database to its original type