mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-12-01 04:24:02 +01:00
Use getClassName instead of overwriting createInstance.
This commit is contained in:
@@ -38,16 +38,13 @@ class GroupLayerMapper extends AbstractLayerMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function createInstance(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||||
{
|
{
|
||||||
$class = $model->groupType === 'feature'
|
if ($model->groupType === 'feature') {
|
||||||
? 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup'
|
return 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup';
|
||||||
: static::$definitionClass;
|
}
|
||||||
|
|
||||||
$reflector = new \ReflectionClass($class);
|
return parent::getClassName($model, $mapper, $bounds); // TODO: Change the autogenerated stub
|
||||||
$instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds));
|
|
||||||
|
|
||||||
return $instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -53,18 +53,13 @@ class ProviderLayerMapper extends AbstractLayerMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function createInstance(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||||
{
|
{
|
||||||
if (isset($this->providers[$model->tile_provider]['class'])) {
|
if (isset($this->providers[$model->tile_provider]['class'])) {
|
||||||
$class = $this->providers[$model->tile_provider]['class'];
|
return $this->providers[$model->tile_provider]['class'];
|
||||||
} else {
|
|
||||||
$class = static::$definitionClass;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$reflector = new \ReflectionClass($class);
|
return parent::getClassName($model, $mapper, $bounds);
|
||||||
$instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds));
|
|
||||||
|
|
||||||
return $instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -43,16 +43,13 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
protected function createInstance(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null)
|
||||||
{
|
{
|
||||||
if ($model->deferred) {
|
if ($model->deferred) {
|
||||||
$reflector = new \ReflectionClass('Netzmacht\LeafletPHP\Plugins\Ajax\GeoJsonAjax');
|
return 'Netzmacht\LeafletPHP\Plugins\Ajax\GeoJsonAjax';
|
||||||
$instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds));
|
|
||||||
|
|
||||||
return $instance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return parent::createInstance($model, $mapper, $bounds);
|
return parent::getClassName($model, $mapper, $bounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user