schmittjoh / JMSJobQueueBundle

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

JobController can't resolve Jobs #202

Open tartexs opened 6 years ago

tartexs commented 6 years ago

I having a problem with the webinterface, i can access to jobs list (.../jobs/) but can't access to job details e.g. (.../jobs/13) because can't resolve job parameter for controller action

{"code":500,"message":"An internal server error has occurred","exception":{"message":"Controller \"JMS\\JobQueueBundle\\Controller\\JobController::detailsAction()\" requires that you provide a value for the \"$job\" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.

a quick solution for this was change the JobController.php and add a quick find for the job by id

/**
 * @Route("/{id}", name = "jms_jobs_details")
 * @Template("JMSJobQueueBundle:Job:details.html.twig")
 */
public function detailsAction($id)
{
    $qb = $this->getEm()->createQueryBuilder();
    $qb->select('j')->from('JMSJobQueueBundle:Job', 'j')
        ->where($qb->expr()->eq('j.id', $id));
    $query = $qb->getQuery();
    $job = $query
      ->setMaxResults(1)
      ->getOneOrNullResult();
    ...

}

maybe my problem is related with webinterface installation.