Skip to content

Commit 83e6297

Browse files
authored
Merge pull request #429 from razvanbalosin/master
ProductPartitions::showAdGroupTree() - Check if child index was already exists
2 parents 455cdbd + 9936111 commit 83e6297

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

src/Google/AdsApi/AdWords/Shopping/v201702/ProductPartitions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ public static function showAdGroupTree(AdWordsServices $adWordsServices,
241241
if ($page->getEntries() !== null) {
242242
$totalNumEntries = $page->getTotalNumEntries();
243243
foreach ($page->getEntries() as $adGroupCriterion) {
244-
$children[$adGroupCriterion->getCriterion()->getId()] = [];
244+
if (!array_key_exists($adGroupCriterion->getCriterion()->getId(), $children)) {
245+
$children[$adGroupCriterion->getCriterion()->getId()] = [];
246+
}
245247

246248
if ($adGroupCriterion->getCriterion()->getParentCriterionId()
247249
!== null) {

src/Google/AdsApi/AdWords/Shopping/v201705/ProductPartitions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ public static function showAdGroupTree(AdWordsServices $adWordsServices,
241241
if ($page->getEntries() !== null) {
242242
$totalNumEntries = $page->getTotalNumEntries();
243243
foreach ($page->getEntries() as $adGroupCriterion) {
244-
$children[$adGroupCriterion->getCriterion()->getId()] = [];
244+
if (!array_key_exists($adGroupCriterion->getCriterion()->getId(), $children)) {
245+
$children[$adGroupCriterion->getCriterion()->getId()] = [];
246+
}
245247

246248
if ($adGroupCriterion->getCriterion()->getParentCriterionId()
247249
!== null) {

src/Google/AdsApi/AdWords/Shopping/v201708/ProductPartitions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ public static function showAdGroupTree(AdWordsServices $adWordsServices,
241241
if ($page->getEntries() !== null) {
242242
$totalNumEntries = $page->getTotalNumEntries();
243243
foreach ($page->getEntries() as $adGroupCriterion) {
244-
$children[$adGroupCriterion->getCriterion()->getId()] = [];
244+
if (!array_key_exists($adGroupCriterion->getCriterion()->getId(), $children)) {
245+
$children[$adGroupCriterion->getCriterion()->getId()] = [];
246+
}
245247

246248
if ($adGroupCriterion->getCriterion()->getParentCriterionId()
247249
!== null) {

src/Google/AdsApi/AdWords/Shopping/v201710/ProductPartitions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ public static function showAdGroupTree(AdWordsServices $adWordsServices,
241241
if ($page->getEntries() !== null) {
242242
$totalNumEntries = $page->getTotalNumEntries();
243243
foreach ($page->getEntries() as $adGroupCriterion) {
244-
$children[$adGroupCriterion->getCriterion()->getId()] = [];
244+
if (!array_key_exists($adGroupCriterion->getCriterion()->getId(), $children)) {
245+
$children[$adGroupCriterion->getCriterion()->getId()] = [];
246+
}
245247

246248
if ($adGroupCriterion->getCriterion()->getParentCriterionId()
247249
!== null) {

0 commit comments

Comments
 (0)