php - Saving spatial data in CakePHP -
i have problem saving spatial data in cakephp saveall(). dont want write query manually (handling spatial data in cakephp) because there number of models being saved.
also read cakephp , mysql spatial extension when try same, $db->expression() returns stdclass.
this returned object printed out:
stdclass object ( [type] => expression [value] => geomfromtext('point(48.18879 18.527579999999944)') ) if use object way used in cakephp , mysql spatial extension , try save saveall() error:
error: cannot use object of type stdclass array
file: /www/s/t/u47728/public_html/lib/cake/model/model.php
line: 2221
if use value property, gets escaped in query becomes string. error:
error: sqlstate[22003]: numeric value out of range: 1416 cannot geometry object data send geometry field
does saveall() suport expressions?
update
apparently same applies save() function , others.... savefield()
convert line :
$this->data['report']['position'] = $db->expression("geomfromtext('point(" . $this->data['report']['lat'] . " " . $this->data['report']['lng'] . ")')"); to :
$this->data['report']['position'] = (object) $db->expression("geomfromtext('point(" . $this->data['report']['lat'] . " " . $this->data['report']['lng'] . ")')"); it should work.
Comments
Post a Comment