Skip to content

Can create two instances of Shopify SDK #226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vicn1222 opened this issue May 1, 2021 · 2 comments
Open

Can create two instances of Shopify SDK #226

vicn1222 opened this issue May 1, 2021 · 2 comments

Comments

@vicn1222
Copy link

vicn1222 commented May 1, 2021

Static is used in ShopifySDK.php. It is not reentry. Can't create two instances of ShopifySDK.

Can developers please remove static?

Thanks.

@bavamca
Copy link

bavamca commented Jun 1, 2021

i thought yes , you can use two instance
but you need to specify name space sperate for each instances

@marxolly
Copy link
Contributor

I use a parent class and have a function in it

protected function resetConfig($config)
{
return PHPShopify\ShopifySDK::config($config);
}

Then I have extending classes that have their own private config array

In each of these extending classes, I call the function resetConfig so the Shopify object has the correct configuration before I call any of the PHPShopify functions

Using this method, I have set up 4 different instances of the Shopify object for use with different clients and shops inside my web application

Hope this might help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants