egeloen / IvoryGoogleMapBundle

Google Map API v3 integration for your Symfony2 project.
https://github.com/egeloen/ivory-google-map
MIT License
217 stars 152 forks source link

Update of the bundle made my markers not working #62

Closed dupuchba closed 11 years ago

dupuchba commented 11 years ago

Hi @egeloen ,

I just updated the bundle and only the last one marker is displaying on the google map... which is a problem. My code is something like that: \ouse Ivory\GoogleMap\Overlays\Animation; puse Ivory\GoogleMap\Overlays\Animation;

$markerX = $this->get('ivory_google_map.marker');
$markerX->setPrefixJavascriptVariable('marker_');
$markerX->setPosition(47.214962,-1.55429, true);

$eventX = $this->get('ivory_google_map.event');
$eventX->setInstance($marker4->getJavascriptVariable());
$eventX->setEventName('click');
$eventX->setHandle('function(){showShopInMap("boucherie-du-bouffay")}');

I have 3 of them... any idea

egeloen commented 11 years ago

Can you provide the full marker creation with the marker addition on the map & the JS ouput? Thx

dupuchba commented 11 years ago

here it is (the code is pretty shit but that's life... :) )

    $map = $this->get('ivory_google_map.map');

    $map->setPrefixJavascriptVariable('map_');
    $map->setHtmlContainerId('map_canvas');
    $map->setAsync(false);

    $map->setCenter(46.875213, -0.296631, true);
    $map->setMapOption('zoom', 8);

    $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);

    $map->setStylesheetOptions(array(
        'width' => '100%',
        'height' => '500px'
    ));

    $marker6 = $this->get('ivory_google_map.marker');
    $marker6->setPrefixJavascriptVariable('marker_');
    $marker6->setPosition(46.556027,0.304871, true);
    $markerImage6 = $this->get('ivory_google_map.marker_image');
    $markerImage6->setUrl('http://www.google.com/intl/en_us/mapfiles/ms/micons/yellow-dot.png');
    $marker6->setIcon($markerImage6);

    $event6 = $this->get('ivory_google_map.event');
    $event6->setInstance($marker6->getJavascriptVariable());
    $event6->setEventName('click');
    $event6->setHandle('function(){showShopInMap("titre6")}');

    $marker7 = $this->get('ivory_google_map.marker');
    $marker7->setPrefixJavascriptVariable('marker_');
    $marker7->setPosition(46.564791,0.356863, true);
    $markerImage7 = $this->get('ivory_google_map.marker_image');
    $markerImage7->setUrl('http://www.google.com/intl/en_us/mapfiles/ms/micons/yellow-dot.png');
    $marker7->setIcon($markerImage7);

    $event7 = $this->get('ivory_google_map.event');
    $event7->setInstance($marker7->getJavascriptVariable());
    $event7->setEventName('click');
    $event7->setHandle('function(){showShopInMap("titre7")}');

    $map->addMarker($marker6);
    $map->addMarker($marker7);

    $event6->setCapture(true);
    $event7->setCapture(true);

    $map->getEventManager()->addDomEvent($event6);
    $map->getEventManager()->addDomEvent($event7);
egeloen commented 11 years ago

Can you confirm me $marker6 !== $marker7 ?

dupuchba commented 11 years ago

That's the problem, for an unknow reasons, they are the same but I set differents position...

egeloen commented 11 years ago

Okay, I'm sorry but there is a BC break in the last refactos that makes it not usable in your way anymore. If you want to keep your app working, you can lock the bundle to his 1.0.0 version.

I will update the doc & UPGRADE file accordingly.

egeloen commented 11 years ago

@dupuchba All should work again now :)

dupuchba commented 11 years ago

Cool :), thx @egeloen !