We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon Classes can't be founded within Class that extends Thread (or Threaded)

Hi there,

I am using Threads (PHP7 + pthreads) for performance optimisation. I builded a class which extends Thread.

class MyClass extends \Thread

In the function "run()" of this class, I want to access a Manager Class (extends Component). But this class can't be founded. I always get this error:

PHP Fatal error:  Uncaught Error: Class 'MyManager' not found in /.../Response.php:37

It seems that the class extended from Thread doesn't has any access to other namespaces.

Does anybody know a solution for it?

Thanks!



13.8k

It seems that there is a problem with the autoloader. In Thread context the Phalcon classes etc. are not loaded (and they cannot be found in Thread context).

Is there any solution for it?



85.5k

i dont know what phthread is but my guess is

require vendor/autoload.php ?


13.8k

Tried all the autoloader things (even from phalcon itself). Doesnt work

I experience the same problem. Tell me, was it possible to solve the problem?