diff --git a/src/Queue/Components/IJobControlFactory.php b/src/Queue/Components/IJobControlFactory.php index 5b9234cf..0d9a7fa1 100755 --- a/src/Queue/Components/IJobControlFactory.php +++ b/src/Queue/Components/IJobControlFactory.php @@ -18,8 +18,9 @@ interface IJobControlFactory { /** + * @param integer $id * @return \Venne\Queue\Components\JobControl */ - public function create(); + public function create($id); } diff --git a/src/Queue/Components/JobControl.php b/src/Queue/Components/JobControl.php index 7acab057..bde9cc9a 100755 --- a/src/Queue/Components/JobControl.php +++ b/src/Queue/Components/JobControl.php @@ -24,6 +24,9 @@ class JobControl extends \Venne\System\UI\Control { + /** @var integer */ + private $id; + /** @var \Nette\Security\User */ private $user; @@ -33,24 +36,29 @@ class JobControl extends \Venne\System\UI\Control /** @var \Venne\DataTransfer\DataTransferManager */ private $dataTransferManager; + /** + * @param integer $id + * @param \Doctrine\ORM\EntityManager $entityManager + * @param \Nette\Security\User $user + * @param \Venne\DataTransfer\DataTransferManager $dataTransferManager + */ public function __construct( + $id, EntityManager $entityManager, User $user, DataTransferManager $dataTransferManager ) { parent::__construct(); + $this->id = $id; $this->jobRepository = $entityManager->getRepository(Job::class); $this->user = $user; $this->dataTransferManager = $dataTransferManager; } - /** - * @param int $id - */ - public function handleRemove($id) + public function handleRemove() { - if (($entity = $this->jobRepository->find($id)) === null) { + if (($entity = $this->jobRepository->find($this->id)) === null) { throw new BadRequestException; } @@ -65,11 +73,11 @@ public function handleRemove($id) } } - public function render($id) + public function render() { $this->template->job = $this->dataTransferManager - ->createQuery(JobDto::class, function () use ($id) { - return $this->jobRepository->find($id); + ->createQuery(JobDto::class, function () { + return $this->jobRepository->find($this->id); }) ->enableCache() ->fetch(); diff --git a/src/Queue/Components/JobsControl.latte b/src/Queue/Components/JobsControl.latte index 49194866..b06d254b 100755 --- a/src/Queue/Components/JobsControl.latte +++ b/src/Queue/Components/JobsControl.latte @@ -1,18 +1,18 @@ {var $count = count($jobs)} - {$count} + {$jobCount}