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!



2.1k

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?



67.7k

i dont know what phthread is but my guess is

require vendor/autoload.php ?


2.1k

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