/** * Get the list of jobs that are declared among all the connectors * * @return array with job alias => job */ protected function getAllJobs() { $jobs = []; $jobTypes = $this->connectorRegistry->getConnectors(); foreach ($jobTypes as $jobType) { $connectorTypes = $this->connectorRegistry->getJobs($jobType); foreach ($connectorTypes as $jobsConnectorType) { $jobs = array_merge($jobs, $jobsConnectorType); } } return $jobs; }
/** * Add alias field * * @param FormBuilderInterface $builder * * @return \Pim\Bundle\ImportExportBundle\Form\Type\JobInstanceType */ protected function addAliasField(FormBuilderInterface $builder) { $choices = []; foreach ($this->connectorRegistry->getJobs($this->jobType) as $connector => $jobs) { if ('oro_importexport' !== $connector) { foreach ($jobs as $key => $job) { $choices[$connector][$key] = $job->getName(); } } } $builder->add('alias', 'choice', array('choices' => $choices, 'required' => true, 'by_reference' => false, 'mapped' => false, 'empty_value' => 'Select a job', 'empty_data' => null, 'label' => 'Job')); return $this; }
/** * Return filter choices for the connector column * * @param string $type * * @return array */ protected function getConnectorChoices($type) { $connectors = array_keys($this->registry->getJobs($type)); return empty($connectors) ? [] : array_combine($connectors, $connectors); }