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