Skip to content

Commit

Permalink
Readd support for explicitly preconfiguring source table srid; only u…
Browse files Browse the repository at this point in the history
…sed if detection fails (e.g. materialized views)
  • Loading branch information
werrolf committed Jun 14, 2022
1 parent 9ae0e92 commit a7ab82e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Component/FeatureType.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class FeatureType extends DataStore
*/
protected $geomField = 'geom';

/** @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
*/
Expand All @@ -65,6 +68,9 @@ class FeatureType extends DataStore

protected function configure(array $args)
{
if (!empty($args['srid'])) {
$this->configuredSrid = \intval($args['srid']) ?: null;
}
if (array_key_exists('geomField', $args)) {
$this->geomField = $args['geomField'];
}
Expand Down Expand Up @@ -287,7 +293,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;
}

Expand Down

0 comments on commit a7ab82e

Please sign in to comment.