dereuromark / cakephp-queue

Queue plugin for CakePHP - simple, pure PHP and without dependencies.
MIT License
307 stars 136 forks source link

Deprecation message with CakePHP 4.5.0 #388

Closed mrothauer closed 10 months ago

mrothauer commented 10 months ago

the command bin/cake queue worker end server triggers a deprecation message

CakePHP 4.5.0 Queue-Version: 6.7.2

4.5.0 - Dynamic properties will be removed in PHP 8.2. Add public $QueueProcesses = null; to your class definition. /my-app/vendor/cakephp/cakephp/src/Command/Command.php, line: 56 You can disable all deprecation warnings by setting Error.errorLevel to E_ALL & ~E_USER_DEPRECATED. Adding vendor/cakephp/cakephp/src/Command/Command.php to Error.ignoredDeprecationPaths in your config/app.php config will mute deprecations from that file only. Trace: /my-app/vendor/cakephp/cakephp/src/Core/functions.php /my-app/vendor/cakephp/cakephp/src/Core/functions.php, line 300 /my-app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php /my-app/vendor/cakephp/cakephp/src/Datasource/ModelAwareTrait.php, line 122 Cake\Command\Command->loadModel() /my-app/vendor/cakephp/cakephp/src/Command/Command.php, line 56 Cake\Command\Command->__construct() /my-app/vendor/cakephp/cakephp/src/Console/CommandFactory.php, line 51 Cake\Console\CommandFactory->create() /my-app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 375 Cake\Console\CommandRunner->createCommand() /my-app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 248 Cake\Console\CommandRunner->getCommand() /my-app/vendor/cakephp/cakephp/src/Console/CommandRunner.php, line 167 Cake\Console\CommandRunner->run() /my-app/bin/cake.php, line 12

dereuromark commented 10 months ago

Do u want to make a PR removing all those property usage? Or just adding the missing property?

dereuromark commented 10 months ago

The alternative I would prefer right now is to set the attribute for it.

#[AllowDynamicProperties]

This has less changes and thus less possible negative side effects for now.

mrothauer commented 10 months ago

Do u want to make a PR removing all those property usage? Or just adding the missing property?

This time, I prefer not to be involved in fixing my issue. If that's ok for you.

dereuromark commented 10 months ago

I started https://github.com/dereuromark/cakephp-queue/pull/389 I will see what can be done regarding the loadModel() calls. Adding the property doesnt work and creates errors. So either we refactor fully or we need to silence the deprecations if attribute is there

dereuromark commented 10 months ago

https://github.com/dereuromark/cakephp-queue/releases/tag/6.8.0 should already help a bit with deprecations

mrothauer commented 10 months ago

Thanks. I updated my app but I still get the same deprecation message.

dereuromark commented 10 months ago

Well, the main issue wont go away unless we ship https://github.com/cakephp/cakephp/pull/17383 and you use PHP 8.2+

The alternative would be to completely refactor away from properties and use fetchTable() everywhere, similar to what already done in 5.x version I assume.

mrothauer commented 10 months ago

Well, the main issue wont go away unless we ship cakephp/cakephp#17383 and you use PHP 8.2+

Ok, thank you for the clarification. I'll wait for that.

dereuromark commented 10 months ago

I am not sure it is gonna happen You could backport similar changes as https://github.com/dereuromark/cakephp-queue/compare/7.0.0-RC...7.0.0 to Cake4 branch. Then we can release a patch here.

mrothauer commented 10 months ago

If its fixed when I switch to CakePHP 5, thats fine for me. So I won't backport the changings.