Skip to content
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

Make the library usable without the \Recurly_Client::$apiKey #318

Closed
romainneutron opened this issue Jun 20, 2017 · 7 comments
Closed

Make the library usable without the \Recurly_Client::$apiKey #318

romainneutron opened this issue Jun 20, 2017 · 7 comments
Labels
V2 V2 Client

Comments

@romainneutron
Copy link
Contributor

It would be great if the library would be usable without the static property. It would allow us to have multiple recurly clients instantiated at the same time.
At the moment, the __createNodeObject factory in base.php prevents us to do that.

@drewish
Copy link

drewish commented Jun 20, 2017

Could you say more about the goal of multiple clients? I'd think resources would preserve the client they were initialized with and pass that on other resources that they load.

@romainneutron
Copy link
Contributor Author

romainneutron commented Jun 21, 2017

We're having two client for billing inside USA and outside USA (I don't know the details, however it seems required for legal reasons)

Resource preserve the client they were initialized with except in some edge case, when \Recurly_Resource::__createNodeObject is called, it creates new resources without the client:

#0  Recurly_Client->__construct() called at [.../vendor/recurly/recurly-client/lib/recurly/base.php:13]
#1  Recurly_Base->__construct() called at .../vendor/recurly/recurly-client/lib/recurly/resource.php:19]
#2  Recurly_Resource->__construct() called at [.../vendor/recurly/recurly-client/lib/recurly/plan.php:40]
#3  Recurly_Plan->__construct() called at [.../vendor/recurly/recurly-client/lib/recurly/base.php:425]
#4  Recurly_Base::__createNodeObject() called at [.../vendor/recurly/recurly-client/lib/recurly/base.php:255]
#5  Recurly_Base::__parseResponseToNewObject() called at [.../vendor/recurly/recurly-client/lib/recurly/base.php:29]
#6  Recurly_Base::_get() called at [.../vendor/recurly/recurly-client/lib/recurly/plan.php:46]
#7  Recurly_Plan::get() 

@bhelx
Copy link
Contributor

bhelx commented Jun 21, 2017

@romainneutron can you provide any example code as to how you are trying to accomplish this?

@nsanden
Copy link

nsanden commented Jun 24, 2018

I'd love to see the library updated to not use static at all and name spaced. At the moment, it feels very uncomfortable to use.

@bhelx
Copy link
Contributor

bhelx commented Jun 24, 2018

@nsanden I think we agree on the principle, but that would mean a very difficult upgrade path for our customers.

@nsanden
Copy link

nsanden commented Jun 24, 2018

php sdk v2 perhaps :)

@aaron-junot
Copy link

Closing out this issue due to the fact that it will not be implemented in this major version of the library

@bhelx bhelx added the V2 V2 Client label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V2 V2 Client
Projects
None yet
Development

No branches or pull requests

5 participants