examples/AdWords/v201809/Migration/MigrateToExtensionSettings.php
private static function deleteOldFeedItems(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $feedItemIds,
        $feedId
    ) {
        if (count($feedItemIds) === 0) {
            return;
        }

        $feedItemService = $adWordsServices->get($session, FeedItemService::class);

        $operations = [];
        foreach ($feedItemIds as $feedItemId) {
            $feedItem = new FeedItem();
            $feedItem->setFeedId($feedId);
            $feedItem->setFeedItemId($feedItemId);

            $operation = new FeedItemOperation();
            $operation->setOperand($feedItem);
            $operation->setOperator(Operator::REMOVE);
            $operations[] = $operation;
        }

        printf(
            "Deleting %d old feed items from feed ID %d...\n",
            count($feedItemIds),
            $feedId
        );

        return $feedItemService->mutate($operations);
    }
private static function deleteOldFeedItems(
        AdWordsServices $adWordsServices,
        AdWordsSession $session,
        $feedItemIds,
        $feedId
    ) {
        if (count($feedItemIds) === 0) {
            return;
        }

        $feedItemService = $adWordsServices->get($session, FeedItemService::class);

        $operations = [];
        foreach ($feedItemIds as $feedItemId) {
            $feedItem = new FeedItem();
            $feedItem->setFeedId($feedId);
            $feedItem->setFeedItemId($feedItemId);

            $operation = new FeedItemOperation();
            $operation->setOperand($feedItem);
            $operation->setOperator(Operator::REMOVE);
            $operations[] = $operation;
        }

        printf(
            "Deleting %d old feed items from feed ID %d...\n",
            count($feedItemIds),
            $feedId
        );

        return $feedItemService->mutate($operations);
    }
private static function deleteOldFeedItems ( AdWordsServices $ adWordsServices , AdWordsSession $ session , $ feedItemIds , $ feedId ) { if ( count ( $ feedItemIds ) === 0 ) { return ; } $ feedItemService = $ adWordsServices -> get ( $ session , FeedItemService :: class ) ; $ operations = [ ] ; foreach ( $ feedItemIds as $ feedItemId ) { $ feedItem = new FeedItem ( ) ; $ feedItem -> setFeedId ( $ feedId ) ; $ feedItem -> setFeedItemId ( $ feedItemId ) ; $ operation = new FeedItemOperation ( ) ; $ operation -> setOperand ( $ feedItem ) ; $ operation -> setOperator ( Operator :: REMOVE ) ; $ operations [ ] = $ operation ; } printf ( "Deleting %d old feed items from feed ID %d...\n" , count ( $ feedItemIds ) , $ feedId ) ; return $ feedItemService -> mutate ( $ operations ) ; }
Deletes old feed items that became unused anymore after migration.
Deletes old feed items that became unused anymore after migration .