schmittjoh / JMSJobQueueBundle

Run and Schedule Symfony Console Commands as Background Jobs
http://jmsyst.com/bundles/JMSJobQueueBundle
335 stars 254 forks source link

Retry a failed job will lose related entities #189

Open bschultz opened 7 years ago

bschultz commented 7 years ago

We are using this bundle in our project with related entities. We have some failed jobs and wanted to retry them but unfortunately when using the retry button in the web interface the related entites will not be set for the new retry job.

After checking the code I saw that in the JobController the original job is just cloned and inside the __clone function of the Job entity the related entities are resetted: $this->relatedEntities = new ArrayCollection();

In my opinion this is an issue because when you rely on those entities you can't retry the failed jobs because important information are lost.

mcorteel commented 4 years ago

Job::getRelatedEntities could be modified to fetch related entities on the originalJob if any.