diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/GroupLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/GroupLayerMapper.php index 2391438..9f8324d 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/GroupLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/GroupLayerMapper.php @@ -38,16 +38,13 @@ class GroupLayerMapper extends AbstractLayerMapper /** * {@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' - ? 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup' - : static::$definitionClass; + if ($model->groupType === 'feature') { + return 'Netzmacht\LeafletPHP\Definition\Group\FeatureGroup'; + } - $reflector = new \ReflectionClass($class); - $instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds)); - - return $instance; + return parent::getClassName($model, $mapper, $bounds); // TODO: Change the autogenerated stub } /** diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ProviderLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ProviderLayerMapper.php index 1986124..f8e534a 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ProviderLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/ProviderLayerMapper.php @@ -53,18 +53,13 @@ class ProviderLayerMapper extends AbstractLayerMapper /** * {@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'])) { - $class = $this->providers[$model->tile_provider]['class']; - } else { - $class = static::$definitionClass; + return $this->providers[$model->tile_provider]['class']; } - $reflector = new \ReflectionClass($class); - $instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds)); - - return $instance; + return parent::getClassName($model, $mapper, $bounds); } /** diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php index 658740b..6593f5a 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php @@ -43,16 +43,13 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper /** * {@inheritdoc} */ - protected function createInstance(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null) + protected function getClassName(\Model $model, DefinitionMapper $mapper, LatLngBounds $bounds = null) { if ($model->deferred) { - $reflector = new \ReflectionClass('Netzmacht\LeafletPHP\Plugins\Ajax\GeoJsonAjax'); - $instance = $reflector->newInstanceArgs($this->buildConstructArguments($model, $mapper, $bounds)); - - return $instance; + return 'Netzmacht\LeafletPHP\Plugins\Ajax\GeoJsonAjax'; } - return parent::createInstance($model, $mapper, $bounds); + return parent::getClassName($model, $mapper, $bounds); } /**