googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
295 stars 262 forks source link

ResourceNames::forLifeEvent and forDetailedDemographic is removed in v14 and v15 #979

Closed Lehren closed 9 months ago

Lehren commented 9 months ago

Hi there, Similar to #946 I recently upgraded my google ads API PHP package from v13 to v14. Right after that I got some errors from my code checker.

Call to undefined static method Google\Ads\GoogleAds\Util\V14\ResourceNames::forLifeEvent()

and

Call to undefined static method Google\Ads\GoogleAds\Util\V14\ResourceNames::forDetailedDemographic()

The reason for the error is that these methods are removed from version 14.

Using google-ads-php v21.1.0

Since it was a breaking change for me, my questions are: why isn’t this listed in the v13 to v14 changes documentation? How can I prevent such a problem in the future?

Thanks in advance for the response.

Lehren commented 9 months ago

Also occurs in V15

fiboknacky commented 9 months ago

Hello,

Really sorry for your inconvenience. The source generator reads the protobuf definitions and automatically generates the methods you see in ResourceNames. Since some protobuf definitions were created a long time ago when the Google Ads API was first launched, some of the resources weren't defined with relatively new syntax necessary for the script to know that it should create a resource name method for it.

LifeEvent and DetailedDemographic were probably one of them.

As a short-term solution, I'll compare the resource names utility of v13 with v14 and v15 and add back all the missing methods. For a long run, I'll sync with the API team to add a syntax necessary for the script to generate resource name methods for those resources of new versions of the Google Ads API.

fiboknacky commented 9 months ago

Work in progress in #985

fiboknacky commented 9 months ago

Fixed with the v22.0.0 release.