Default format on custom type


I’m actually working with a PostreSQL / PostGIS database. I’ve create a custom Point type like below :

Point.php :

class Point {
	public $lat;
	public $lon;
	public static function parse($value) {
		$value = explode(",", $value);
		return new Point($value[0], $value[1]);

	public function __construct($lat, $lon) {
		$this->lat = $lat;
		$this->lon = $lon;

PointType.php :

class PointType extends BaseType implements ExpressionTypeInterface
	public function toPHP($value, Driver $d) {
		return Point::parse($value);

	public function marshal($value) {
		if (is_string($value)) {
			$value = explode(',', $value);
		if (is_array($value)) {
			return new Point($value["lat"], $value["lon"]);
		return null;

	public function toExpression($value) {
		if ($value instanceof Point) {
			$lat = $value->lat;
			$lon = $value->lon;
		if (is_array($value)) {
			$lat = $value["lat"];
			$lon = $value["lon"];
		return new FunctionExpression("ST_PointFromText", ["POINT($lat $lon)", 4326]);

It works very well for INSERT/UPDATE queries, but when I try to make a SELECT query, the point field is not well formated : I get it like “0101000020E6100000B3976DA7AD0F4940E770ADF6B0EF2C40”.

So what I need is to apply some Postgis functions by default in my SELECT query, like this :

What the select query is :
SELECT Table.point AS "Table__point" FROM table Table

What I want :
SELECT ST_Y(Table.point) || ',' || ST_X(Table.point) AS "Table__point" FROM table Table

So, any suggestion is welcomed !