Saturday, 9 April 2016

Resolving class definition conflicts in googleads/googleads-php-lib

Hello,

When using composer, classes from https://github.com/googleads/googleads-php-lib are available in the global namespace due to the library's use of composer's "classmap".

The README.ME in the repository suggest that when using v201601 of the library, this has to be added to the project's composer.json:

  "classmap": [      "vendor/googleads/googleads-php-lib/src/Google/Api/Ads/AdWords/Util/v201601"    ]

This loads classes for the used version from the "Util" directory only. However, I'm not sure how I can autoload only v201601 classes from other needed directories (e.g. services from AdWords/v201601 only).

Currently, if I import a class, e.g.:

"use CampaignOperation", the IDE is confused because it can see multiple class declaration for all API versions. 

I'm not sure if this warning can be safely ignored as it's only the IDE being confused, or the lib version I'm using has to be explicitly autoloaded with composer.

Also the README says that:

"Thus, if you use composer, you will still need to manually copy over the version of the utility files you need to use. "

I do not understand that, do I need to copy files manually somewhere?

I hope you will help me get going with this lib. Thanks!

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/4c09234e-33a2-4a0c-ba65-d33b18fb3150%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment