@@ -271,7 +271,9 @@ public function getByCampaignIds(array $campaignIds, array $predicates = []): ar
271271 if (count ($ notFound ) > 0 ) {
272272 $ selector = new Selector ();
273273 $ selector ->setFields (self ::$ fields );
274- $ predicates [] = new Predicate ('CampaignId ' , PredicateOperator::IN , $ notFound );
274+ $ predicates [] = new Predicate ('CampaignId ' , PredicateOperator::IN , array_map (function (int $ id ): string {
275+ return $ id . '' ;
276+ }, $ notFound ));
275277 $ selector ->setPredicates ($ predicates );
276278 $ fromService = $ this ->doRequest (function () use ($ selector ): array {
277279 /**
@@ -314,7 +316,9 @@ public function getByAdGroupIds(array $adGroupIds, array $predicates = []): arra
314316 if (count ($ notFound ) > 0 ) {
315317 $ selector = new Selector ();
316318 $ selector ->setFields (self ::$ fields );
317- $ predicates [] = new Predicate ('AdGroupId ' , PredicateOperator::IN , $ notFound );
319+ $ predicates [] = new Predicate ('AdGroupId ' , PredicateOperator::IN , array_map (function (int $ id ): string {
320+ return $ id . '' ;
321+ }, $ notFound ));
318322 $ selector ->setPredicates ($ predicates );
319323 $ fromService = $ this ->doRequest (function () use ($ selector ): array {
320324 /**
@@ -383,13 +387,17 @@ public function update(array $entities): UpdateResult
383387 */
384388 $ this ->logger ->info ('Add chunk # ' . $ i . '. Size: ' . count ($ addChunk ));
385389 $ jobResults = $ this ->runMutateJob ($ addChunk );
386- $ this ->processJobResult ($ result , $ jobResults );
387- if (!$ result ->success ) {
388- foreach ($ result ->errors as $ adOperationId => $ errors ) {
389- $ adOperation = $ addChunk [$ adOperationId ];
390- $ adId = $ adOperation ->getOperand ()->getAd ()->getId ();
391- unset($ deleteOperations [$ adId ]);
390+ if (is_array ($ jobResults )) {
391+ $ this ->processJobResult ($ result , $ jobResults );
392+ if (!$ result ->success ) {
393+ foreach ($ result ->errors as $ adOperationId => $ errors ) {
394+ $ adOperation = $ addChunk [$ adOperationId ];
395+ $ adId = $ adOperation ->getOperand ()->getAd ()->getId ();
396+ unset($ deleteOperations [$ adId ]);
397+ }
392398 }
399+ } else {
400+ throw new ErrorException ('Empty result from google ' );
393401 }
394402 }
395403
@@ -410,7 +418,11 @@ public function update(array $entities): UpdateResult
410418 }
411419 }
412420 }
413- $ this ->processJobResult ($ result , $ jobResults );
421+ if (is_array ($ jobResults )) {
422+ $ this ->processJobResult ($ result , $ jobResults );
423+ } else {
424+ throw new ErrorException ('Empty result from google ' );
425+ }
414426 }
415427 } else {
416428 $ mutateResult = $ this ->adGroupAdService ->mutate ($ addOperations );
0 commit comments