propelorm / Propel2

Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP
http://propelorm.org/
MIT License
1.26k stars 398 forks source link

How to set a value of POINT WKB to Geometry column? #1473

Open kk3377 opened 6 years ago

kk3377 commented 6 years ago

Hi, Currency im having trouble saving a value of POINT to Geometry column with no avail. Here is the xml schema.

<table name="user" phpName="User">
<column name="geo_location" type="GEOMETRY" phpType="string" required="true"/>
</table>

I have tried to insert the value in way shown below but both failed too.

  1. set using GeomFromText $user->setGeoLocation('GeomFromText("POINT(101.732339 3.002545)")');
  2. using phayes/geophp to generate geometry value in binary and pass in to the setter
    $polygon = geoPHP::load('POINT(101.732339 3.002545)','wkt');
    $user->setGeoLocation($polygon->asBinary());

Returning error message is "SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field"

Any help is appreciated. Thanks

dereuromark commented 4 years ago

Is someone able to make a PR here with suggested changes?