Commit 849955b7 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Merge branch 'Substitution'

parents 9e1c7003 8c96fab7
Loading
Loading
Loading
Loading
Loading

code/structure.php

0 → 100644
+50 −0
Original line number Diff line number Diff line
<?php

/**
 * @var $this \Zend\View\Renderer\PhpRenderer
 * @var $controller \UnicaenCode\Controller\Controller
 * @var $viewName string
 */

use Application\Entity\Db\Structure;
use Application\Entity\Db\UniteRecherche;
use Application\Service\Structure\StructureService;


/** @var StructureService $structureService */
$structureService = $controller->getServiceLocator()->get(StructureService::class);

///** @var Structure $s1 */
///** @var Structure $s2 */
///** @var Structure $s3 */
//$s1 = $structureService->getEntityManager()->getRepository(UniteRecherche::class)->findOneBySourceCode('UCN::UMR6176');
//$s2 = $structureService->getEntityManager()->getRepository(UniteRecherche::class)->findOneBySourceCode('UCN::UMR6185');
//$s3 = $structureService->getEntityManager()->getRepository(UniteRecherche::class)->findOneBySourceCode('UCN::UMR6194');
//
//$dataObject = new UniteRecherche();
//$dataObject->setLibelle('UMR6176 * UMR6185 * UMR6194');
//$dataObject->setCheminLogo('/tmp/test.png');
//$dataObject->setSigle('U*U*U');
//
//$strSubstits = $structureService->createStructureSubstitutions([$s1, $s2, $s3], $dataObject);
//$sc = $strSubstits[0]->getToStructure();


/** @var UniteRecherche $sc */
$sc = $structureService->getEntityManager()->getRepository(UniteRecherche::class)->createQueryBuilder('ur')
    ->join('ur.structure', 's')
    ->where('s.sigle = :sigle')
    ->setParameter('sigle', 'U*U*U')
    ->getQuery()->getSingleResult();
//var_dump($sc, count($sc->getStructure()->getStructuresSubstituees()));
array_map(
    function(Structure $s) {
        var_dump($s->getSourceCode());
    },
    $sc->getStructure()->getStructuresSubstituees()->toArray()
);




//$sc = $structureService->getEntityManager()->getRepository(UniteRecherche::class)->findOneBySigle('U*U*U');
+2 −1
Original line number Diff line number Diff line
@@ -22,7 +22,8 @@
        "ramsey/uuid":                          "^3.3",
        "mpdf/mpdf":                            "v6.1.3",
        "bjyoungblood/bjy-authorize":           "dev-master",
        "guzzlehttp/guzzle":                    "^6.3"
        "guzzlehttp/guzzle":                    "^6.3",
        "webmozart/assert": "^1.3"
    },
    "autoload": {
        "psr-0": {
+68 −68
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
        "This file is @generated automatically"
    ],
    "content-hash": "4b0b46293affec3e3b53426489dcffa9",
    "content-hash": "4f660f69449c8f1de3b517246c2ee7f6",
    "packages": [
        {
            "name": "bjyoungblood/bjy-authorize",
@@ -1240,16 +1240,16 @@
        },
        {
            "name": "paragonie/random_compat",
            "version": "v2.0.11",
            "version": "v2.0.12",
            "source": {
                "type": "git",
                "url": "https://github.com/paragonie/random_compat.git",
                "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8"
                "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8",
                "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8",
                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/258c89a6b97de7dfaf5b8c7607d0478e236b04fb",
                "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb",
                "shasum": ""
            },
            "require": {
@@ -1284,7 +1284,7 @@
                "pseudorandom",
                "random"
            ],
            "time": "2017-09-27T21:40:39+00:00"
            "time": "2018-04-04T21:24:14+00:00"
        },
        {
            "name": "psr/http-message",
@@ -1643,7 +1643,7 @@
        },
        {
            "name": "symfony/debug",
            "version": "v3.4.7",
            "version": "v3.4.8",
            "source": {
                "type": "git",
                "url": "https://github.com/symfony/debug.git",
@@ -1758,16 +1758,16 @@
        },
        {
            "name": "symfony/process",
            "version": "v2.8.37",
            "version": "v2.8.38",
            "source": {
                "type": "git",
                "url": "https://github.com/symfony/process.git",
                "reference": "c2fc900ee54e1e44aa956eae8ba041a5347ba93c"
                "reference": "ee2c91470ff262b1a00aec27875d38594aa87629"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/symfony/process/zipball/c2fc900ee54e1e44aa956eae8ba041a5347ba93c",
                "reference": "c2fc900ee54e1e44aa956eae8ba041a5347ba93c",
                "url": "https://api.github.com/repos/symfony/process/zipball/ee2c91470ff262b1a00aec27875d38594aa87629",
                "reference": "ee2c91470ff262b1a00aec27875d38594aa87629",
                "shasum": ""
            },
            "require": {
@@ -1803,7 +1803,7 @@
            ],
            "description": "Symfony Process Component",
            "homepage": "https://symfony.com",
            "time": "2018-03-19T21:11:56+00:00"
            "time": "2018-04-03T05:20:27+00:00"
        },
        {
            "name": "unicaen/app",
@@ -1858,11 +1858,11 @@
        },
        {
            "name": "unicaen/auth",
            "version": "1.2.5",
            "version": "1.2.6",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/auth.git",
                "reference": "4f1a531c08b1474340e9d90e92a1ad7b18dda620"
                "reference": "1f7658396139734e9d4c0dfd46bd14011e2b5e8d"
            },
            "require": {
                "bjyoungblood/bjy-authorize": ">=1.4",
@@ -1884,15 +1884,15 @@
                ]
            },
            "description": "Module d'authentification pour les applications Unicaen",
            "time": "2018-03-28T08:19:16+00:00"
            "time": "2018-04-09T07:41:56+00:00"
        },
        {
            "name": "unicaen/code",
            "version": "1.1.4",
            "version": "1.1.6",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/code.git",
                "reference": "b31f1857684c45c78c60c8e14dc72ad73e363819"
                "reference": "607fe27c60c3c90a6c953cf2b16bfdbdc8b54d17"
            },
            "require": {
                "doctrine/dbal": "^2.5",
@@ -1910,7 +1910,7 @@
                ]
            },
            "description": "Boite à outils pour la programmation avec la bibliothèque Unicaen",
            "time": "2018-03-20T15:11:11+00:00"
            "time": "2018-04-12T15:24:29+00:00"
        },
        {
            "name": "unicaen/faq",
@@ -2063,6 +2063,56 @@
            "description": "Bibliothèque utile lorsqu'on utilise un base de données Oracle",
            "time": "2018-02-26T10:03:19+00:00"
        },
        {
            "name": "webmozart/assert",
            "version": "1.3.0",
            "source": {
                "type": "git",
                "url": "https://github.com/webmozart/assert.git",
                "reference": "0df1908962e7a3071564e857d86874dad1ef204a"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
                "reference": "0df1908962e7a3071564e857d86874dad1ef204a",
                "shasum": ""
            },
            "require": {
                "php": "^5.3.3 || ^7.0"
            },
            "require-dev": {
                "phpunit/phpunit": "^4.6",
                "sebastian/version": "^1.0.1"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "1.3-dev"
                }
            },
            "autoload": {
                "psr-4": {
                    "Webmozart\\Assert\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Bernhard Schussek",
                    "email": "bschussek@gmail.com"
                }
            ],
            "description": "Assertions to validate method input/output with nice error messages.",
            "keywords": [
                "assert",
                "check",
                "validate"
            ],
            "time": "2018-01-29T19:49:41+00:00"
        },
        {
            "name": "zendframework/zend-developer-tools",
            "version": "1.0.0",
@@ -3724,56 +3774,6 @@
            },
            "description": "Module de base pour implémenter des tests unitaires/fonctionnels",
            "time": "2018-02-26T15:47:19+00:00"
        },
        {
            "name": "webmozart/assert",
            "version": "1.3.0",
            "source": {
                "type": "git",
                "url": "https://github.com/webmozart/assert.git",
                "reference": "0df1908962e7a3071564e857d86874dad1ef204a"
            },
            "dist": {
                "type": "zip",
                "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a",
                "reference": "0df1908962e7a3071564e857d86874dad1ef204a",
                "shasum": ""
            },
            "require": {
                "php": "^5.3.3 || ^7.0"
            },
            "require-dev": {
                "phpunit/phpunit": "^4.6",
                "sebastian/version": "^1.0.1"
            },
            "type": "library",
            "extra": {
                "branch-alias": {
                    "dev-master": "1.3-dev"
                }
            },
            "autoload": {
                "psr-4": {
                    "Webmozart\\Assert\\": "src/"
                }
            },
            "notification-url": "https://packagist.org/downloads/",
            "license": [
                "MIT"
            ],
            "authors": [
                {
                    "name": "Bernhard Schussek",
                    "email": "bschussek@gmail.com"
                }
            ],
            "description": "Assertions to validate method input/output with nice error messages.",
            "keywords": [
                "assert",
                "check",
                "validate"
            ],
            "time": "2018-01-29T19:49:41+00:00"
        }
    ],
    "aliases": [],
+15 −0
Original line number Diff line number Diff line
<?php

use Application\Service\Source\SourceService;
use Application\Service\Source\SourceServiceFactory;

return [
    'service_manager' => [
        'factories' => [
            SourceService::class => SourceServiceFactory::class,
        ],
        'aliases' => [
            'SourceService' => SourceService::class,
        ]
    ],
];
+167 −0
Original line number Diff line number Diff line
<?php

use Application\Controller\Factory\EcoleDoctoraleControllerFactory;
use Application\Form\Factory\EcoleDoctoraleFormFactory;
use Application\Form\Factory\EcoleDoctoraleHydratorFactory;
use Application\Provider\Privilege\EcoleDoctoralePrivileges;
use Application\Service\EcoleDoctorale\EcoleDoctoraleService;
use Application\Service\Structure\StructureService;
use Application\Service\Structure\StructureServiceFactory;
use Application\View\Helper\EcoleDoctoraleHelper;
use UnicaenAuth\Guard\PrivilegeController;
use Application\Entity\Db\StructureConcreteInterface;
use Application\View\Helper\StructureSubstitHelper;
return [
    'bjyauthorize'    => [
//        'guards' => [
//            PrivilegeController::class => [
//                [
//                    'controller' => 'Application\Controller\EcoleDoctorale',
//                    'action'     => [
//                        'index',
//                    ],
//                    'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_CONSULTATION,
//                ],
//                [
//                    'controller' => 'Application\Controller\EcoleDoctorale',
//                    'action'     => [
//                        'ajouter',
//                        'supprimer',
//                        'restaurer',
//                        'modifier',
//                        'ajouter-individu',
//                        'retirer-individu',
//                    ],
//                    'privileges' => EcoleDoctoralePrivileges::ECOLE_DOCT_MODIFICATION,
//                ],
//            ],
//        ],
    ],
    'router'          => [
        'routes' => [
//            'ecole-doctorale' => [
//                'type'          => 'Segment',
//                'options'       => [
//                    'route'    => '/[:language/]ecole-doctorale',
//                    'defaults' => [
//                        '__NAMESPACE__' => 'Application\Controller',
//                        'controller'    => 'EcoleDoctorale',
//                        'action'        => 'index',
//                        'language'      => 'fr_FR',
//                    ],
//                ],
//                'may_terminate' => true,
//                'child_routes'  => [
//                    'ajouter' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/ajouter',
//                            'defaults'    => [
//                                'action' => 'ajouter',
//                            ],
//                        ],
//                    ],
//                    'supprimer' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/supprimer',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'supprimer',
//                            ],
//                        ],
//                    ],
//                    'restaurer' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/restaurer',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'restaurer',
//                            ],
//                        ],
//                    ],
//                    'modifier' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/modifier',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'modifier',
//                            ],
//                        ],
//                    ],
//                    'ajouter-individu' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/ajouter-individu',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'ajouter-individu',
//                            ],
//                        ],
//                    ],
//                    'retirer-individu' => [
//                        'type'          => 'Segment',
//                        'options'       => [
//                            'route'       => '/:ecoleDoctorale/retirer-individu/:edi',
//                            'constraints' => [
//                                'ecoleDoctorale' => '\d+',
//                                'edi' => '\d+',
//                            ],
//                            'defaults'    => [
//                                'action' => 'retirer-individu',
//                            ],
//                        ],
//                    ],
//                ],
//            ],
        ],
    ],
    'navigation'      => [
        'default' => [
//            'home' => [
//                'pages' => [
//                    'admin' => [
//                        'pages' => [
//                            'ecole-doctorale' => [
//                                'label'    => 'Écoles doctorales',
//                                'route'    => 'ecole-doctorale',
//                                'resource' => PrivilegeController::getResourceId('Application\Controller\EcoleDoctorale', 'index'),
//                            ],
//                        ],
//                    ],
//                ],
//            ],
        ],
    ],
    'service_manager' => [
        'factories' => [
            StructureService::class => StructureServiceFactory::class,
        ],
        'aliases' => [
            'StructureService' => StructureService::class,
        ]
    ],
    'controllers'     => [
        'invokables' => [
        ],
        'factories' => [
//            'Application\Controller\EcoleDoctorale' => EcoleDoctoraleControllerFactory::class,
        ],
    ],
    'view_helpers' => [
        'invokables' => array(
            'structureSubstitHelper' => StructureSubstitHelper::class,
        ),
        'factories' => [],
    ],
];
Loading