Skip to content
Snippets Groups Projects
Commit 610ce710 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'release-3.0'

parents 4a2af998 dafbf022
Branches
Tags
No related merge requests found
Pipeline #7462 failed
......@@ -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;
/**
*
......@@ -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;
}
......
......@@ -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.
*/
......@@ -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("=====================================");
......@@ -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);
......@@ -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);
......@@ -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);
......
......@@ -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'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment