Loading src/UnicaenOracle/Controller/Factory/IndexControllerFactory.php +6 −10 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace UnicaenOracle\Controller\Factory; use Interop\Container\ContainerInterface; use UnicaenOracle\Controller\IndexController; use UnicaenOracle\Service\DataService; use UnicaenOracle\Service\SchemaService; use Zend\Mvc\Controller\ControllerManager; /** * Loading @@ -15,25 +15,21 @@ use Zend\Mvc\Controller\ControllerManager; class IndexControllerFactory { /** * @param ControllerManager $manager * @param ContainerInterface $container * @return IndexController */ public function __invoke(ControllerManager $manager) public function __invoke(ContainerInterface $container) { $sl = $manager->getServiceLocator(); /** @var SchemaService $schemaService */ $schemaService = $sl->get(SchemaService::class); $schemaService = $container->get(SchemaService::class); /** @var DataService $dataService */ $dataService = $sl->get(DataService::class); $dataService = $container->get(DataService::class); $controller = new IndexController(); $controller->setSchemaService($schemaService); $controller->setDataService($dataService); // todo: ne plus injecter le service locator, svp! $controller->setServiceLocator($manager->getServiceLocator()); $controller->setContainer($container); return $controller; } Loading src/UnicaenOracle/Controller/IndexController.php +22 −11 Original line number Diff line number Diff line Loading @@ -3,20 +3,31 @@ namespace UnicaenOracle\Controller; use Doctrine\DBAL\Connection; use Interop\Container\ContainerInterface; use UnicaenOracle\Service\Traits\DataServiceAwareTrait; use UnicaenOracle\Service\Traits\SchemaServiceAwareTrait; use Zend\Log\LoggerAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\ServiceManager\ServiceLocatorAwareInterface; use Zend\ServiceManager\ServiceLocatorAwareTrait; class IndexController extends AbstractActionController implements ServiceLocatorAwareInterface class IndexController extends AbstractActionController { use ServiceLocatorAwareTrait; use SchemaServiceAwareTrait; use DataServiceAwareTrait; use LoggerAwareTrait; /** * @var ContainerInterface */ protected $container; /** * @param ContainerInterface $container */ public function setContainer(ContainerInterface $container) { $this->container = $container; } /** * Action en mode CLI. */ Loading @@ -26,7 +37,7 @@ class IndexController extends AbstractActionController implements ServiceLocator $connName = $this->params('connection', 'doctrine.connection.orm_default'); /** @var Connection $connection */ $connection = $this->getServiceLocator()->get($connName); $connection = $this->container->get($connName); $schemaName = $this->schemaService->extractSchemaNameFromConnection($connection); $this->log("====================================="); Loading Loading @@ -55,8 +66,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading Loading @@ -87,8 +98,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading Loading @@ -121,8 +132,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading src/UnicaenOracle/Service/SchemaService.php +1 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ WITH TMP(CATEG, NAME, SQL) AS ( -- constraints -- -- d'abord les FK -- les FK en premier select 'I_CONSTRAINT', constraint_name, 'ALTER TABLE ' || OWNER || '.' || table_name || ' drop CONSTRAINT ' || constraint_name || ';' || chr(10) from all_constraints where constraint_type = 'R' Loading Loading
src/UnicaenOracle/Controller/Factory/IndexControllerFactory.php +6 −10 Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace UnicaenOracle\Controller\Factory; use Interop\Container\ContainerInterface; use UnicaenOracle\Controller\IndexController; use UnicaenOracle\Service\DataService; use UnicaenOracle\Service\SchemaService; use Zend\Mvc\Controller\ControllerManager; /** * Loading @@ -15,25 +15,21 @@ use Zend\Mvc\Controller\ControllerManager; class IndexControllerFactory { /** * @param ControllerManager $manager * @param ContainerInterface $container * @return IndexController */ public function __invoke(ControllerManager $manager) public function __invoke(ContainerInterface $container) { $sl = $manager->getServiceLocator(); /** @var SchemaService $schemaService */ $schemaService = $sl->get(SchemaService::class); $schemaService = $container->get(SchemaService::class); /** @var DataService $dataService */ $dataService = $sl->get(DataService::class); $dataService = $container->get(DataService::class); $controller = new IndexController(); $controller->setSchemaService($schemaService); $controller->setDataService($dataService); // todo: ne plus injecter le service locator, svp! $controller->setServiceLocator($manager->getServiceLocator()); $controller->setContainer($container); return $controller; } Loading
src/UnicaenOracle/Controller/IndexController.php +22 −11 Original line number Diff line number Diff line Loading @@ -3,20 +3,31 @@ namespace UnicaenOracle\Controller; use Doctrine\DBAL\Connection; use Interop\Container\ContainerInterface; use UnicaenOracle\Service\Traits\DataServiceAwareTrait; use UnicaenOracle\Service\Traits\SchemaServiceAwareTrait; use Zend\Log\LoggerAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\ServiceManager\ServiceLocatorAwareInterface; use Zend\ServiceManager\ServiceLocatorAwareTrait; class IndexController extends AbstractActionController implements ServiceLocatorAwareInterface class IndexController extends AbstractActionController { use ServiceLocatorAwareTrait; use SchemaServiceAwareTrait; use DataServiceAwareTrait; use LoggerAwareTrait; /** * @var ContainerInterface */ protected $container; /** * @param ContainerInterface $container */ public function setContainer(ContainerInterface $container) { $this->container = $container; } /** * Action en mode CLI. */ Loading @@ -26,7 +37,7 @@ class IndexController extends AbstractActionController implements ServiceLocator $connName = $this->params('connection', 'doctrine.connection.orm_default'); /** @var Connection $connection */ $connection = $this->getServiceLocator()->get($connName); $connection = $this->container->get($connName); $schemaName = $this->schemaService->extractSchemaNameFromConnection($connection); $this->log("====================================="); Loading Loading @@ -55,8 +66,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading Loading @@ -87,8 +98,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading Loading @@ -121,8 +132,8 @@ class IndexController extends AbstractActionController implements ServiceLocator /** @var Connection $srcConn */ /** @var Connection $dstConn */ $srcConn = $this->getServiceLocator()->get($srcConnName); $dstConn = $this->getServiceLocator()->get($dstConnName); $srcConn = $this->container->get($srcConnName); $dstConn = $this->container->get($dstConnName); $srcSchemaName = $this->schemaService->extractSchemaNameFromConnection($srcConn); $dstSchemaName = $this->schemaService->extractSchemaNameFromConnection($dstConn); Loading
src/UnicaenOracle/Service/SchemaService.php +1 −1 Original line number Diff line number Diff line Loading @@ -239,7 +239,7 @@ WITH TMP(CATEG, NAME, SQL) AS ( -- constraints -- -- d'abord les FK -- les FK en premier select 'I_CONSTRAINT', constraint_name, 'ALTER TABLE ' || OWNER || '.' || table_name || ' drop CONSTRAINT ' || constraint_name || ';' || chr(10) from all_constraints where constraint_type = 'R' Loading