@@ 70-87 (lines=18) @@ | ||
67 | * @param string $name |
|
68 | * @return bool |
|
69 | */ |
|
70 | public function isRunning($name) |
|
71 | { |
|
72 | try { |
|
73 | $this->getEntityManager() |
|
74 | ->createQuery('SELECT r |
|
75 | FROM GloobyTaskBundle:QueuedTask r |
|
76 | WHERE r.name = :name AND r.status = :status') |
|
77 | ->setParameter('name', $name) |
|
78 | ->setParameter('status', QueuedTaskInterface::STATUS_RUNNING) |
|
79 | ->useQueryCache(true) |
|
80 | ->setMaxResults(1) |
|
81 | ->getSingleResult(); |
|
82 | ||
83 | return true; |
|
84 | } catch (NoResultException $e) { |
|
85 | return false; |
|
86 | } |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * @param string $name |
|
@@ 93-110 (lines=18) @@ | ||
90 | * @param string $name |
|
91 | * @return bool |
|
92 | */ |
|
93 | public function isQueued($name) |
|
94 | { |
|
95 | try { |
|
96 | $this->getEntityManager() |
|
97 | ->createQuery('SELECT r |
|
98 | FROM GloobyTaskBundle:QueuedTask r |
|
99 | WHERE r.name = :name AND r.status = :status') |
|
100 | ->setParameter('name', $name) |
|
101 | ->setParameter('status', QueuedTaskInterface::STATUS_QUEUED) |
|
102 | ->useQueryCache(true) |
|
103 | ->setMaxResults(1) |
|
104 | ->getSingleResult(); |
|
105 | ||
106 | return true; |
|
107 | } catch (NoResultException $e) { |
|
108 | return false; |
|
109 | } |
|
110 | } |
|
111 | } |
|
112 |