Commit 5accc8ba authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

Merge branches 'master' and 'zf-3.x' of https://git.unicaen.fr/lib/unicaen/tbl

# Conflicts:
#	.gitlab-ci.yml
parents ae737cf5 22c73eee
Pipeline #5364 failed with stage
in 12 seconds
......@@ -19,4 +19,4 @@ cache:
update-satis:
stage: publish
script:
- update-satis
\ No newline at end of file
- update-satis
......@@ -4,11 +4,11 @@
"repositories": [
{
"type": "composer",
"url" : "https://dev.unicaen.fr/packagist"
"url" : "https://gest.unicaen.fr/packagist"
}
],
"require" : {
"unicaen/app": "^1.3 || dev-trunk"
"unicaen/app": "^3.0"
},
"require-dev" : {
"phpunit/PHPUnit": "^5.6"
......
<?php
namespace UnicaenTbl\Controller\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Controller\AdminController;
use UnicaenTbl\Form\ActualisationForm;
use UnicaenTbl\Service\QueryGeneratorService;
use UnicaenTbl\Service\SchemaService;
use UnicaenTbl\Service\TableauBordService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
class AdminControllerFactory implements FactoryInterface
class AdminControllerFactory
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
*
* @return AdminController
*/
public function createService(ServiceLocatorInterface $serviceLocator)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$controller = new AdminController();
$sl = $serviceLocator->getServiceLocator();
$controller->setServiceSchema(
$sl->get(SchemaService::class)
$container->get(SchemaService::class)
);
$controller->setServiceQueryGenerator(
$sl->get(QueryGeneratorService::class)
$container->get(QueryGeneratorService::class)
);
$controller->setServiceTableauBord(
$sl->get(TableauBordService::class)
$container->get(TableauBordService::class)
);
$controller->setFormActualisation(
$sl->get('FormElementManager')->get(ActualisationForm::class)
$container->get('FormElementManager')->get(ActualisationForm::class)
);
return $controller;
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
......@@ -2,10 +2,8 @@
namespace UnicaenTbl\Form\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Form\ActualisationForm;
use Zend\Form\FormElementManager;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
......@@ -13,18 +11,10 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*/
class ActualisationFormFactory implements FactoryInterface {
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
*
* @return mixed
*/
public function createService(ServiceLocatorInterface $serviceLocator)
class ActualisationFormFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$sl = $serviceLocator->getServiceLocator();
$form = new ActualisationForm();
return $form;
......
......@@ -2,27 +2,21 @@
namespace UnicaenTbl\Options\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Options\ModuleOptions;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
* Description of ModuleOptionsFactory
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class ModuleOptionsFactory implements FactoryInterface
class ModuleOptionsFactory
{
/**
* Create service
*
* @param ServiceLocatorInterface $serviceLocator
* @return mixed
*/
public function createService(ServiceLocatorInterface $serviceLocator)
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$config = $serviceLocator->get('Configuration');
$config = $container->get('Configuration');
return new ModuleOptions(isset($config['unicaen-tbl']) ? $config['unicaen-tbl'] : []);
}
}
\ No newline at end of file
<?php
namespace UnicaenTbl\Service\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Options\ModuleOptions;
use UnicaenTbl\Service\QueryGeneratorService;
use UnicaenTbl\Service\SchemaService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
......@@ -13,20 +13,21 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*/
class QueryGeneratorServiceFactory implements FactoryInterface {
public function createService(ServiceLocatorInterface $serviceLocator)
class QueryGeneratorServiceFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$queryGenerator = new QueryGeneratorService();
/** @var ModuleOptions $options */
$options = $serviceLocator->get(ModuleOptions::class);
$options = $container->get(ModuleOptions::class);
$em = $serviceLocator->get($options->getEntityManagerName()); /* @var $em \Doctrine\ORM\EntityManager */
$em = $container->get($options->getEntityManagerName());
/* @var $em \Doctrine\ORM\EntityManager */
$queryGenerator->setOptionsModule($options);
$queryGenerator->setEntityManager($em);
$queryGenerator->setServiceSchema( $serviceLocator->get(SchemaService::class) );
$queryGenerator->setServiceSchema($container->get(SchemaService::class));
return $queryGenerator;
}
......
<?php
namespace UnicaenTbl\Service\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Options\ModuleOptions;
use UnicaenTbl\Service\SchemaService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
......@@ -12,19 +12,21 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*/
class SchemaServiceFactory implements FactoryInterface {
public function createService(ServiceLocatorInterface $serviceLocator)
class SchemaServiceFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$schema = new SchemaService();
/** @var ModuleOptions $options */
$options = $serviceLocator->get(ModuleOptions::class);
$options = $container->get(ModuleOptions::class);
$em = $serviceLocator->get($options->getEntityManagerName()); /* @var $em \Doctrine\ORM\EntityManager */
$em = $container->get($options->getEntityManagerName());
/* @var $em \Doctrine\ORM\EntityManager */
$schema->setEntityManager($em);
return $schema;
}
}
\ No newline at end of file
<?php
namespace UnicaenTbl\Service\Factory;
use Interop\Container\ContainerInterface;
use UnicaenTbl\Options\ModuleOptions;
use UnicaenTbl\Service\TableauBordService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
/**
......@@ -12,16 +12,17 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*
* @author LECLUSE Laurent <laurent.lecluse at unicaen.fr>
*/
class TableauBordServiceFactory implements FactoryInterface {
public function createService(ServiceLocatorInterface $serviceLocator)
class TableauBordServiceFactory
{
public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
{
$tbl = new TableauBordService();
/** @var ModuleOptions $options */
$options = $serviceLocator->get(ModuleOptions::class);
$options = $container->get(ModuleOptions::class);
$em = $serviceLocator->get($options->getEntityManagerName()); /* @var $em \Doctrine\ORM\EntityManager */
$em = $container->get($options->getEntityManagerName());
/* @var $em \Doctrine\ORM\EntityManager */
$tbl->setEntityManager($em);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment