prolic / HumusAmqp

PHP 7.4 AMQP library
https://humusamqp.readthedocs.io/
MIT License
76 stars 17 forks source link

Humus\Amqp\Driver can't be cached #34

Closed alexz707 closed 7 years ago

alexz707 commented 7 years ago

HI! I am using both your libs in a zf3 application. When I try to cache the configuration (config cache = true in ZF3) it will raise an Exception because the class does not implement the set_state magic function. Maybe it also concerns marc-mabe/php-enum ?

Exception: `[27-Apr-2017 15:51:01 Europe/Berlin] PHP Fatal error: Uncaught InvalidArgumentException: Humus\Amqp\Driver\Driver::__set_state not defined in /var/www/html/vendor/marc-mabe/php-enum/src/Enum.php:220 Stack trace:

0 /var/www/html/vendor/marc-mabe/php-enum/src/Enum.php(434): MabeEnum\Enum::byName('__set_state')

1 /var/www/html/data/cache/module-config-cache.application.config.cache.php(404): MabeEnum\Enum::callStatic('set_state', Array)

2 /var/www/html/vendor/zendframework/zend-modulemanager/src/Listener/ConfigListener.php(392): include('/var/www/html/d...')

3 /var/www/html/vendor/zendframework/zend-modulemanager/src/Listener/ConfigListener.php(70): Zend\ModuleManager\Listener\ConfigListener->getCachedConfig()

4 /var/www/html/vendor/zendframework/zend-modulemanager/src/Listener/DefaultListenerAggregate.php(98): Zend\ModuleManager\Listener\ConfigListener->__construct(Object(Zend\ModuleManager\Listener\ListenerOptions))

5 /var/www/html/vendor/zendframework/zend-modulemanager/src/Listener/DefaultListenerAggregate.php(42): Zend\ModuleManager\Listener\DefaultL in /var/www/html/vendor/zendframework/zend-servicemanager/src/ServiceManager.php on line 765

`

Config file: 'humus' => [ 'amqp' => [ 'driver' => Driver::AMQP_EXTENSION(),

Regards alex

prolic commented 7 years ago

you should put 'amqp-extension' or 'php-amqplib' in your config, not an instance of the driver class.

alexz707 commented 7 years ago

Thanks for info and sry for stealing your time ;) Did use the instance by mistake - I'll close the question!

regards alex

prolic commented 7 years ago

:+1:

you're welcome