skip to Main Content

I am using SDK from http://devbay.net/sdk/guides/api/namespace-DTS.eBaySDK.html
And I need use Finding and Trading services in one file.
How can i declare different namespaces

use DTSeBaySDKConstants;
use DTSeBaySDKFindingServices;
use DTSeBaySDKFindingTypes;
use DTSeBaySDKFindingEnums;


use DTSeBaySDKTradingServices;
use DTSeBaySDKTradingTypes;
use DTSeBaySDKTradingEnums;

PHP Fatal error: Cannot use DTSeBaySDKTradingServices as Services because the name is already in use

So is any other way to do this ?

2

Answers


  1. Namespace 1 {
    //your logic
    }

    Namespace2{
    //your logic

    }

    Login or Signup to reply.
  2. You can use aliases:

    use DTSeBaySDKConstants;
    use DTSeBaySDKFindingServices as FServices;
    use DTSeBaySDKFindingTypes as FTypes;
    use DTSeBaySDKFindingEnums as FEnums;
    
    
    use DTSeBaySDKTradingServices as TServices;
    use DTSeBaySDKTradingTypes as TTypes;
    use DTSeBaySDKTradingEnums as TEnums;
    

    Though to avoid confusion with these newly introduced names, you could fall back to import only DTSeBaySDKFinding and DTSeBaySDKTrading and explicitly use the types there like this:

    use DTSeBaySDKConstants;
    use DTSeBaySDKFinding;
    use DTSeBaySDKTrading;
    
    $fs = new FindingServicesFindingService();
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search