diff --git a/module/Application/src/Application/Controller/FileController.php b/module/Application/src/Application/Controller/FileController.php index 6b20c9b..4bf894a 100644 --- a/module/Application/src/Application/Controller/FileController.php +++ b/module/Application/src/Application/Controller/FileController.php @@ -62,19 +62,34 @@ class FileController extends AbstractActionController $verbose = $request->getParam('verbose', false) || $request->getParam('v', false); $dryrun = $request->getParam('dry-run', false) || $request->getParam('n', false); + // Get config + $globalConfig = array(); - // Get file not sent - $results = $this->entityManager->getRepository('Application\Entity\FluxFileout')->getNotSent(); - if (count($results) == 0) { - $this->output("Rien à traiter.", $verbose); + // Get definition + $reposConfig = array(); + if (array_key_exists('repository', $this->appConfig)) { + $reposConfig = $this->appConfig['repository']; + } + + if (count($reposConfig) == 0 || count($globalConfig) == 0) { + $this->output("Aucune configuration."); } else { - foreach($results as $result) { + // Get file not sent + $results = $this->entityManager + ->getRepository('Application\Entity\FluxFileout')->getNotSent(); + if (count($results) == 0) { + $this->output("Rien à traiter.", $verbose); + } + // Browse files to exec operation + else { + foreach($results as $result) { - echo $result->getFileout(); - $this->output("", $verbose); + echo $result->getFileout(); + $this->output("", $verbose); + } } } diff --git a/module/Application/src/Application/Factory/FileControllerFactory.php b/module/Application/src/Application/Factory/FileControllerFactory.php index 6a2acc4..6dba495 100644 --- a/module/Application/src/Application/Factory/FileControllerFactory.php +++ b/module/Application/src/Application/Factory/FileControllerFactory.php @@ -12,9 +12,14 @@ class FileControllerFactory implements FactoryInterface { $serviceLocator = $serviceLocator->getServiceLocator(); $console = $serviceLocator->get('Console'); - $config = $serviceLocator->get('config'); + $appConfig = $serviceLocator->get('config'); $em = $serviceLocator->get('Doctrine\ORM\EntityManager'); + $config = array(); + if (array_key_exists('flux', $appConfig)) { + $config = $appConfig['flux']; + } + return new FileController($console, $em, $config); } }