From 7d3c053bd19905f5da892861e4c4ac6fe7ef0b0e Mon Sep 17 00:00:00 2001 From: David Molineus Date: Wed, 5 Oct 2016 13:35:04 +0200 Subject: [PATCH] Fix circles. --- src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php | 3 ++- src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php | 3 ++- .../Contao/Leaflet/Mapper/Vector/CircleMarkerMapper.php | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php b/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php index 511f214..6149fea 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/OptionsBuilder.php @@ -12,6 +12,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper; use Netzmacht\LeafletPHP\Definition; +use Netzmacht\LeafletPHP\Definition\HasOptions; /** * Class OptionsBuilder handles the option mapping between the database model and the definition. @@ -236,7 +237,7 @@ class OptionsBuilder if (method_exists($definition, $setter)) { $definition->$setter($value); - } else { + } elseif ($definition instanceOf HasOptions) { $definition->setOption($option, $value); } } diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php index 0c28633..cb39ba7 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMapper.php @@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector; use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\LeafletPHP\Definition; +use Netzmacht\LeafletPHP\Definition\Vector\CircleMarker; use Netzmacht\LeafletPHP\Value\LatLng; use Netzmacht\LeafletPHP\Definition\Vector\Circle; @@ -60,7 +61,7 @@ class CircleMapper extends AbstractVectorMapper ) { parent::build($definition, $model, $mapper, $filter); - if ($definition instanceof Circle) { + if ($definition instanceof CircleMarker) { $definition->setLatLng(LatLng::fromString($model->coordinates)); } } diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMarkerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMarkerMapper.php index 01d0718..61ad12f 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMarkerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Vector/CircleMarkerMapper.php @@ -11,8 +11,6 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector; -use Netzmacht\LeafletPHP\Definition; - /** * Class CircleMarkerMapper maps the database model to the circle marker definition. *