Beispiel #1
0
 public function __construct(ConnectorRegistry $jobRegistry, BatchJobRepository $batchJobRepository, ContextRegistry $contextRegistry, ManagerRegistry $managerRegistry)
 {
     $this->batchJobRegistry = $jobRegistry;
     $this->batchJobManager = $batchJobRepository->getJobManager();
     $this->contextRegistry = $contextRegistry;
     $this->entityManager = $managerRegistry->getManager();
     $this->managerRegistry = $managerRegistry;
 }
Beispiel #2
0
 /**
  * Create and persist job instance.
  *
  * @param string $jobType
  * @param string $jobName
  * @param array $configuration
  * @return JobInstance
  */
 protected function createJobInstance($jobType, $jobName, array $configuration)
 {
     $jobInstance = new JobInstance(self::CONNECTOR_NAME, $jobType, $jobName);
     $jobInstance->setCode($this->generateJobCode($jobName));
     $jobInstance->setLabel(sprintf('%s.%s', $jobType, $jobName));
     if (array_key_exists(self::JOB_CONTEXT_DATA_KEY, $configuration)) {
         unset($configuration[self::JOB_CONTEXT_DATA_KEY]);
     }
     $jobInstance->setRawConfiguration($configuration);
     $this->batchJobRepository->getJobManager()->persist($jobInstance);
     return $jobInstance;
 }
Beispiel #3
0
 /**
  * @param WriterAfterFlushEvent $event
  */
 public function onWriterAfterFlush(WriterAfterFlushEvent $event)
 {
     // keep alive connection for really long integration processes
     $dql = 'SELECT e.id FROM AkeneoBatchBundle:JobExecution e WHERE e.id = 1';
     $this->batchJobRepository->getJobManager()->createQuery($dql)->execute();
 }