| Conditions | 4 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 4.7691 |
| 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( |
||
| 29 | \sprintf('Unable to parse geometry data for column %s.', $key), |
||
| 30 | 0, |
||
| 31 | $e |
||
| 32 | ); |
||
| 33 | } |
||
| 34 | |||
| 35 | 12 | $value = $this->getQuery()->raw("ST_GeomFromText('{$wkt}')"); |
|
| 36 | } |
||
| 37 | } |
||
| 38 | |||
| 39 | 12 | return parent::update($values); |
|
| 40 | } |
||
| 42 |