From 7520cbd55e21dbafd4785357349d08e106accf52 Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 8 Jan 2015 12:52:32 +0100 Subject: [PATCH] Rename Reference to expression. --- .../Leaflet/Mapper/Layer/MarkersLayerMapper.php | 13 +++++-------- .../Leaflet/Mapper/Layer/VectorsLayerMapper.php | 6 +++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php index 177d311..13e850e 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/MarkersLayerMapper.php @@ -15,7 +15,7 @@ use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper; use Netzmacht\Contao\Leaflet\Model\MarkerModel; use Netzmacht\Contao\Leaflet\Request\RequestUrl; -use Netzmacht\Javascript\Type\Value\Reference; +use Netzmacht\Javascript\Type\Value\Expression; use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Definition\Group\GeoJson; @@ -42,16 +42,13 @@ class MarkersLayerMapper 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); } /** @@ -76,7 +73,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper } if ($definition instanceof GeoJson) { - $definition->setPointToLayer(new Reference('ContaoLeaflet.pointToLayer', 'ContaoLeaflet')); + $definition->setPointToLayer(new Expression('ContaoLeaflet.pointToLayer.bind(ContaoLeaflet)')); } } diff --git a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php index 16ecd57..658740b 100644 --- a/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php +++ b/src/Netzmacht/Contao/Leaflet/Mapper/Layer/VectorsLayerMapper.php @@ -16,7 +16,7 @@ use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper; use Netzmacht\Contao\Leaflet\Model\MarkerModel; use Netzmacht\Contao\Leaflet\Model\VectorModel; use Netzmacht\Contao\Leaflet\Request\RequestUrl; -use Netzmacht\Javascript\Type\Value\Reference; +use Netzmacht\Javascript\Type\Value\Expression; use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Definition\Group\GeoJson; @@ -77,8 +77,8 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper } if ($definition instanceof GeoJson) { - $definition->setOnEachFeature(new Reference('ContaoLeaflet.onEachFeature', 'ContaoLeaflet')); - $definition->setPointToLayer(new Reference('ContaoLeaflet.pointToLayer', 'ContaoLeaflet')); + $definition->setOnEachFeature(new Expression('ContaoLeaflet.onEachFeature.bind(ContaoLeaflet)')); + $definition->setPointToLayer(new Expression('ContaoLeaflet.pointToLayer.bind(ContaoLeaflet)')); } }