XF 2.2 Composer error when using composer in cron inside addon

Dannymh

Active member
Hi,

I am building an addon that uses the google client composer package. I have followed the tutorials and have composer configured in the addon. It works in the main addon but does not work in the cron. Instead it gives me an error "Trait '<redacted>\Cron\Google\Client' not found in "

Which is saying to me that its using the name space of the cron and looking in there for the google\client rather than in ../vendor/

Can't figure out how to point it at the correct vendor folder
 
Additionally I made a quick change and its now moved to a class not found, but its still not looking in the vendor folder
 
You would need to use the global namespace prefix (eg. \Google\Client(...) etc.) or import them (use Google\Client;) after your namespace declaration.
 
You would need to use the global namespace prefix (eg. \Google\Client(...) etc.) or import them (use Google\Client;) after your namespace declaration.
I have
Code:
use Google\Client;
however it still causes the error.

Looks like this line
Code:
$client = new Google\Client();
that is causing it
 
If you're importing it with use Google\Client; then it's available as Client:

PHP:
$client = new Client();
 
Top Bottom