diff --git a/Component/FeatureType.php b/Component/FeatureType.php index 365541f..872abde 100644 --- a/Component/FeatureType.php +++ b/Component/FeatureType.php @@ -32,6 +32,9 @@ class FeatureType extends DataStore */ protected $geomField; + /** @var int|null fallback source srid used only if detection fails (e.g. materialized views) */ + protected $configuredSrid; + /** * @var int SRID to get geometry converted to */ @@ -44,6 +47,9 @@ public function __construct(Connection $connection, TokenStorageInterface $token if ($this->geomField && false !== ($key = \array_search($this->geomField, $this->fields))) { unset($this->fields[$key]); } + if (!empty($args['srid'])) { + $this->configuredSrid = \intval($args['srid']) ?: null; + } } public function getFields() @@ -157,7 +163,7 @@ public function itemFromArray(array $values) */ public function getSrid() { - $this->srid = $this->srid ?: $this->getTableMetaData()->getColumn($this->geomField)->getSrid(); + $this->srid = $this->srid ?: $this->getTableMetaData()->getColumn($this->geomField)->getSrid() ?: $this->configuredSrid; return $this->srid; }