Note that there are some explanatory texts on larger screens.

plurals
  1. POSaving spatial data in CakePHP
    primarykey
    data
    text
    <p>I have a problem saving spatial data in CakePHP with saveAll(). I really dont want to write the query manually (<a href="https://stackoverflow.com/questions/4598834/handling-spatial-data-in-cakephp">Handling spatial data in CakePHP</a>) because there are number of models being saved. </p> <p>Also I read this <a href="http://muxe.org/blog/cakephp-and-mysql-spatial-extension" rel="nofollow noreferrer">CakePHP and MySQL Spatial Extension</a> but when I try to do the same, <code>$db-&gt;expression()</code> returns an stdClass.</p> <p>This is the returned object printed out: </p> <pre><code>stdClass Object ( [type] =&gt; expression [value] =&gt; GeomFromText('POINT(48.18879 18.527579999999944)') ) </code></pre> <p>If I use this object the way it is used in <a href="http://muxe.org/blog/cakephp-and-mysql-spatial-extension" rel="nofollow noreferrer">CakePHP and MySQL Spatial Extension</a> and try to save it with saveAll() I get this error:</p> <p><strong>Error</strong>: Cannot use object of type stdClass as array<br> File: /www/s/t/u47728/public_html/lib/Cake/Model/Model.php<br> Line: 2221</p> <p>If I use the value property, it gets escaped in the query so it becomes just a string. Then I get this error:</p> <p><strong>Error</strong>: SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field</p> <p>Does saveAll() suport expressions?</p> <p><strong>UPDATE</strong></p> <p>Apparently the same applies to save() function and others.... Also saveField()</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload