Skip to content

Commit

Permalink
Merge branch 'fix/srid-override-mv-01' into fix/srid-override-mv-02
Browse files Browse the repository at this point in the history
  • Loading branch information
werrolf committed Jun 14, 2022
2 parents 37637cb + a7ab82e commit 19cda59
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 @@ -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
*/
Expand All @@ -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()
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 19cda59

Please sign in to comment.