| Conditions | 4 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.1755 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | 12 | public function update(array $values) |
|
| 21 | { |
||
| 22 | 12 | foreach ($values as $key => &$value) { |
|
| 23 | 12 | if ($value instanceof Geometry) { |
|
| 24 | try { |
||
| 25 | 12 | $wkt = geoPHP::load(json_decode(json_encode($value->jsonSerialize()), FALSE), 'json') |
|
|
|
|||
| 26 | 12 | ->out('wkt'); |
|
| 27 | } catch (\Exception $e) { |
||
| 28 | throw new SpatialParseException(\sprintf('Unable to parse geometry data for column %s.',$key), 0, $e); |
||
| 29 | } |
||
| 30 | |||
| 31 | 12 | $value = $this->getQuery()->raw("ST_GeomFromText('{$wkt}')"); |
|
| 32 | } |
||
| 33 | } |
||
| 34 | |||
| 35 | 12 | return parent::update($values); |
|
| 36 | } |
||
| 38 |