Closed jaroslawziolkowski closed 8 years ago
Hey Jarek,
The error you encountered was probably caused by class name collisions between Kohana 3.2 and the QBO SDK, as both of them included class Response
. Kohana's Response
class got overridden by QBO SDK, and the Response
class from QBO SDK didn't implement factory()
method.
This happened because both Kohana 3.2 and the QBO SDK didn't implement PSR-0 autoload standard to avoid name collisions. At Beanworks, our MVC framework implements PSR-0, so it works well with the QBO SDK. To solve your problem, I would recommend two approaches as follows:
Download and install the official QBO SDK. It doesn't support composer, but you can possibly avoid class name collisions if you only include QBO classes when you need to use them.
Upgrade your Kohana 3.2 to 3.3 which implements PSR-0. This approach will allow you to use composer with the QBO SDK without class name collisions, and avoid all the possible collisions in the future when you install other non PSR-0 vendor libraries.
-Rollie
@waltzofpearls thanks for your answer. Unfortunately using original library has a same error. Only one is upgrade to 3.3. I afraid that some code in application can be incompatible but probably it's only one way.
@waltzofpearls In 3.3 I have same problem :(
Ok, looks like namespace hasn't been introduced into Kohana 3.3 yet.
What if you require the original QBO library files only in the classes where you need to write the integration code? And, in those integration classes if you have to use Kohana's Response
class, just use Kohana_Response
instead?
My guess is that QBO SDK files get included first, and then when Kohana's autoloader refuses to load its own Response
class, since it has already been "declared".
@waltzofpearls kohana 3.3 support namespaces but when I look on your code there is not supported namespaces. I use namespaces in different libraries and it works with kohana 3.3
Right, we are not currently using namespace for the QBO SDK.
Basically we just took QBO's official SDK, wrapped it with a composer installable package, and patched a bug we found during the development. We didn't want to touch QBO SDK's original code too much, so it would be easy for future upgrade.
Hello, after installation by composer on Kohana 3.2 I see error
call to undefined function Response::factory
on each kohana page. Any idea how can I resolve this problem?