ZF-8735: Unable to save a mysql spatial value in a Zend_Db_Table_Row_Abstract

Description

I use a mysql spatial column (POINT) with a spatial index on it. This kind of index doesn't allow a default value nor a NULL value. That's why we have to set it when we insert a row.

Problem : the value is binary and all the ways I tried were leading to this error : SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field

I tried :


// $row is an instance of Zend_Db_Table_Row
$row->point = 0;
$row->save();

$row->point = "\0";
$row->save();

$row->point = NULL;
$row->save();

$row->point = 0x00000000010100000000000000000000000000000000000000; // The hexa of POINT(0,0)
$row->save();

$row->point = "0x00000000010100000000000000000000000000000000000000"; // The hexa of POINT(0,0)
$row->save();

$row->point = "PointFromWKB(Point(0, 0)"; 
$row->save();

Comments

Try this:


$row->point = new Zend_Db_Expr("PointFromWKB(Point(0, 0)"); 
$row->save();

If using Zend_Db_Expr doesn't work for force non-quoted values, please reopen.

-ralph