xyNNN / GoogleTagManagerBundle

Google Tag Manager Bundle for Symfony 2
https://github.com/xyNNN/GoogleTagManagerBundle
GNU Lesser General Public License v3.0
27 stars 15 forks source link

Add 'setData' and 'mergeData' methods, deprecate 'addData' method #21

Closed stefandoorn closed 7 years ago

stefandoorn commented 7 years ago

I think it's good to have more granular control over how data is set to TagManager. Sometimes you simply want to override all (or set), sometimes you want the data to be merged if set from several locations in the request. I've deprecated the 'addData' method and introduced 'setData' for that (simply setting it, overwriting it). The old 'addData' method now simply calls the 'setData' method to not introduce BC.

Next to this, an 'mergeData' method is introduced, that does the merging option. You can keep your old data, and have it merged/overriden where necessary. Simply by using the 'array_merge_recursive' function.

I think this could be a 2.2 release, as it's a minor break by adding a method to the interface we currently use.