Permalink
Browse files

Fixed issue with GetAccountHeirarchy.php when used in the sandbox.

git-svn-id: http://google-api-adwords-php.googlecode.com/svn/trunk@224 bd846e36-b2c2-11de-ae6a-cd50274c347e
  • Loading branch information...
eric.koleda@google.com authored and aminin committed Nov 28, 2011
1 parent 4f050ef commit 3ef8f2bbfe3979289173b934871642df5705255e
Showing with 7 additions and 1 deletion.
  1. +7 −1 examples/v201109/GetAccountHierarchy.php
@@ -103,8 +103,14 @@ function DisplayAccountTree($account, $link, $accounts, $links, $depth) {
$rootAccount = $account;
}
}
+ // The root account may not be returned in the sandbox.
+ if (!isset($rootAccount)) {
+ $rootAccount = new Account();
+ $rootAccount->customerId = 0;
+ $rootAccount->login = $user->GetEmail();
+ }
// Display account tree.
- print "Customer Id, Account Name/Login, Link Status)\n";
+ print "(Customer Id, Account Name/Login, Link Status)\n";
DisplayAccountTree($rootAccount, NULL, $accounts, $childLinks, 0);
} else {
print "No serviced accounts were found.\n";

0 comments on commit 3ef8f2b

Please sign in to comment.