diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f71c9..fd3b47a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,9 @@ RepositoryRegistry and inject the appropriate factory plus DataStore / FeatureTy DataStoreService and FeatureTypeService classes are and will remain incompatible with Symfony 4. +## 0.1.29 +* Re-add support for explicitly preconfiguring source table srid on FeatureType; only used if detection fails (e.g. views using geometry expressions) + ## 0.1.28 * Fix missing detection for native double precision columns when picking default for non-nullable numeric column (see [Mapbender #1396](https://github.com/mapbender/mapbender/issues/1396)) * Fix explicitly entered "0" not saving to nullable numeric columns diff --git a/Component/FeatureType.php b/Component/FeatureType.php index 872abde..5d73d90 100644 --- a/Component/FeatureType.php +++ b/Component/FeatureType.php @@ -164,6 +164,11 @@ public function itemFromArray(array $values) public function getSrid() { $this->srid = $this->srid ?: $this->getTableMetaData()->getColumn($this->geomField)->getSrid() ?: $this->configuredSrid; + if (!$this->srid) { + # Throw a decently helpful exception now instead of throwing a + # hard to parse one ("Invalid sridTo 0") later. + throw new \RuntimeException("SRID detection failure on {$this->tableName}.{$this->geomField}; must supply an 'srid' value in your featuretype configuration"); + } return $this->srid; } diff --git a/README.md b/README.md index cad90fb..6eeb536 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ DataStore configuration supports the following values: | fields | list of strings | names of columns to load into DataItem / Feature objects | null (=auto-detect columns) | | filter | string | valid SQL where clause to build into all `search` invocations | null | | geomField (FeatureType only) | string | name of the geometry column | "geom" | +| srid (FeatureType only) | integer or null | Source srid of `geomField`; used only if detection fails (certain views) | null | NOTE: you should _not_ attempt placing spatial data into the "default" database containing your Doctrine entities. You _will_ encounter errors running Doctrine schema updates.