Closed cbleek closed 4 years ago
was fixed in develop branch of SimpleJobMail module
cbleek@php7-cb:~/Projects/Karriere24$ ./vendor/bin/yawik jobs expire --days=300 --info
10 Jobs
======================================================================
The application has thrown an exception!
======================================================================
Error
Call to a member function format() on null
----------------------------------------------------------------------
/home/cbleek/Projects/Karriere24/vendor/yawik/jobs/src/Controller/ConsoleController.php:204
#0 /home/cbleek/Projects/Karriere24/vendor/yawik/jobs/src/Controller/ConsoleController.php(93): Jobs\Controller\ConsoleController->listExpiredJobs()
#1 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Jobs\Controller\ConsoleController->expireJobsAction()
#2 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\Controller\AbstractActionController->onDispatch()
#3 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#4 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil()
#5 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch()
#6 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-eventmanager/src/EventManager.php(321): Laminas\Mvc\DispatchListener->onDispatch()
#7 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#8 /home/cbleek/Projects/Karriere24/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil()
#9 /home/cbleek/Projects/Karriere24/vendor/yawik/core/bin/yawik(27): Laminas\Mvc\Application->run()
#10 {main}
======================================================================
Previous Exception(s):
@kilip Can you have a look at this, please?
@cbleek @TiSiE
Yes, I will take a look at this issue.
@TiSiE @cbleek
This error caused by null value on Job::datePublishStart
or Job::datePublishEnd
. I fix this error by displaying a null value with N/A
:
Should I exclude jobs that have null value on datePublishStart
and datePublishEnd
from query?
sorry, I missed the question.
No,
the query should expire all jobs with a DatePublishEnd or DatePublishStart Date lower than current date - n days. Maybe the following pseudo code helps to clarify
if ( DatePublishEnd exists and DatePublishEnd < now()-n days ) {
expire
} elseif ( DatePublishStart exists and DatePublishStart < now() - n days ) {
expire
}
@cbleek I think @kilip 's question is, what should be done if both dates are null
If both dates are null, expire the job, too. Active jobs have always a DatePublishStart. So if it's missing, there is another mistake. We should expire these bad jobs to get rid of them.
There are only dateModified or dateCreated left, which are always not null because of the Lifecycle Events.
So only three options if both, datePublishStart and datePublishEnd are null:
I second @cbleek here. There should be no jobs without either datePublishStart or datePubilshEnd.
@cbleek @TiSiE
I have recheck the query and just leave the query as is, because it is working as expected.
@kilip how convenient! :smirk:
look at