Closed burningCatalyst closed 2 years ago
Too few arguments to function OCA\AutoDelete\Cron\AutoDeleteAPI::__construct(), 0 passed
Mean: DI container is not able to autowire your class.
When you end up in line 307 we run into a query exception before and try to instantiate the class with new. Please set a breakpoint in line 303 and debug why the container is not able to resolve your dependency. That can be anything from a missing composer dump-autoload to configuration error.
https://help.nextcloud.com/c/dev/11 is our channel for developer questions.
please reach out to the developer chat or the forum for programming questions, this is not a bug otherwise most apps' background jobs would not work at all
myself also faced the same issue and same error when i create a new background job.
ArgumentCountError: Too few arguments to function OCA\Calendar\BackgroundJob\SendInviteResponseMailJob::__construct(), 0 passed in /var/www/html/lib/private/BackgroundJob/JobList.php on line 281 and exactly 9 expected in /var/www/html/custom_apps/calendar/lib/BackgroundJob/SendInviteResponseMailJob.php:45
Can anyone tell whats wrong ?
@PVince81 can you please tell why this is happening when we create a new background job manual.
Since my nextcloud is only for testing, I reinstalled it and it worked.
@burningCatalyst reinstalled it is not a right solution i guess. can you tell what is causing this issue.
⚠️ This issue respects the following points: ⚠️
Bug description
If I try to add a background job manually (via the jobList->add method) it will be listed in the in the
oc_jobs
table (in the DB):but when it executes it don't give the argument with it and this error will show up:
ArgumentCountError: Too few arguments to function OCA\AutoDelete\Cron\AutoDeleteAPI::__construct(), 0 passed in /var/www/web/lib/private/BackgroundJob/JobList.php on line 307 and exactly 2 expected
Hope you can help :)
Steps to reproduce
* * * * * sudo -u docker bash -l -c 'php -f /var/www/web/cron.php'
Expected behavior
Execute the selfmade background task with the given arguments.
Installation method
Official Docker image
Operating system
No response
PHP engine version
PHP 8.0
Web server
Apache (supported)
Database engine version
MariaDB
Is this bug present after an update or on a fresh install?
Fresh Nextcloud Server install
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
Configuration report
No response
List of activated Apps
Nextcloud Signing status
No response
Nextcloud Logs
Additional info
My second Controller looks like this:
And the Background Job looks like this: