welpdev / mailchimp-bundle

MailChimp integration with Symfony and MailChimp API V3
https://welpdev.github.io/mailchimp-bundle/
MIT License
44 stars 36 forks source link

synchronizeMergeFields Choices Empty Choices Array #7

Closed bassrock closed 7 years ago

bassrock commented 7 years ago

Currently when trying to synchronize the merge fields with a phone number or a birthday type, the api returns the error:

[RuntimeException]                                                                
  400: This resource has not yet implemented array assignment for options.choices.

The issue here is the list-merge fields api returns the object with the choices field, however the subsequent call should not sent the choices field if it is empty.

I am currently fixing this by putting:

if (isset($tag['options']) && isset($tag['options']['choices']) && count($tag['options']['choices']) === 0) {
   unset($tag['options']['choices']);
}

in the synchronizeMerge fields for loop.

Nightbr commented 7 years ago

Hi, yep it's a bug from the MailChimp API. You can create a new merge fields choice list but you can't update it... That's why it returns the error not implemented yet... If you remove all merge fields form MailChimp and try to resynchro it will work.

But you can make a PR if you have a better solution to handle this.

Nightbr commented 7 years ago

Related to this: https://github.com/drewm/mailchimp-api/issues/54

I can add your fix in updateMergeField in order to avoid this erreur... But it doesn't resolve the real problem... It will not update your choice merge field if you change it in your config.yml... This is an issue from the MailChimp API and feel free to contact them... I have already done that...

Other workaround, remove all your type choice merge field from your list throught the MailChimp Panel admin and restart the synchro command. It should work (I use to do this...).

Let me know about this.

Nightbr commented 7 years ago

I also add a short note in the documentation: https://welpdev.github.io/mailchimp-bundle/usage/

Nightbr commented 7 years ago

I have released the 1.0.8 feel free to reopen this if it is not fixed