| @@ 245-273 (lines=29) @@ | ||
| 242 | return $jobClass; |
|
| 243 | } |
|
| 244 | ||
| 245 | public function getRunClass(ContainerBuilder $container) |
|
| 246 | { |
|
| 247 | $runClass = $container->hasParameter('dtc_queue.class_run') ? $container->getParameter('dtc_queue.class_run') : null; |
|
| 248 | if (!$runClass) { |
|
| 249 | switch ($defaultType = $container->getParameter('dtc_queue.default_manager')) { |
|
| 250 | case 'mongodb': |
|
| 251 | $runClass = 'Dtc\\QueueBundle\\Document\\Run'; |
|
| 252 | break; |
|
| 253 | case 'orm': |
|
| 254 | $runClass = 'Dtc\\QueueBundle\\Entity\\Run'; |
|
| 255 | break; |
|
| 256 | default: |
|
| 257 | $runClass = 'Dtc\\QueueBundle\\Model\\Run'; |
|
| 258 | } |
|
| 259 | } |
|
| 260 | ||
| 261 | if (isset($runClass)) { |
|
| 262 | if (!class_exists($runClass)) { |
|
| 263 | throw new \Exception("Can't find Run class $runClass"); |
|
| 264 | } |
|
| 265 | } |
|
| 266 | ||
| 267 | $test = new $runClass(); |
|
| 268 | if (!$test instanceof Run) { |
|
| 269 | throw new \Exception("$runClass must be instance of (or derived from) Dtc\\QueueBundle\\Model\\Run"); |
|
| 270 | } |
|
| 271 | ||
| 272 | return $runClass; |
|
| 273 | } |
|
| 274 | ||
| 275 | public function getRunArchiveClass(ContainerBuilder $container) |
|
| 276 | { |
|
| @@ 275-303 (lines=29) @@ | ||
| 272 | return $runClass; |
|
| 273 | } |
|
| 274 | ||
| 275 | public function getRunArchiveClass(ContainerBuilder $container) |
|
| 276 | { |
|
| 277 | $runArchiveClass = $container->hasParameter('dtc_queue.class_run_archive') ? $container->getParameter('dtc_queue.class_run_archive') : null; |
|
| 278 | if (!$runArchiveClass) { |
|
| 279 | switch ($defaultType = $container->getParameter('dtc_queue.default_manager')) { |
|
| 280 | case 'mongodb': |
|
| 281 | $runArchiveClass = 'Dtc\\QueueBundle\\Document\\RunArchive'; |
|
| 282 | break; |
|
| 283 | case 'orm': |
|
| 284 | $runArchiveClass = 'Dtc\\QueueBundle\\Entity\\RunArchive'; |
|
| 285 | break; |
|
| 286 | default: |
|
| 287 | $runArchiveClass = 'Dtc\\QueueBundle\\Model\\Run'; |
|
| 288 | } |
|
| 289 | } |
|
| 290 | ||
| 291 | if (isset($runArchiveClass)) { |
|
| 292 | if (!class_exists($runArchiveClass)) { |
|
| 293 | throw new \Exception("Can't find RunArchive class $runArchiveClass"); |
|
| 294 | } |
|
| 295 | } |
|
| 296 | ||
| 297 | $test = new $runArchiveClass(); |
|
| 298 | if (!$test instanceof Run) { |
|
| 299 | throw new \Exception("$runArchiveClass must be instance of (or derived from) Dtc\\QueueBundle\\Model\\Run"); |
|
| 300 | } |
|
| 301 | ||
| 302 | return $runArchiveClass; |
|
| 303 | } |
|
| 304 | ||
| 305 | /** |
|
| 306 | * Determines the job class based on the queue manager type. |
|