Skip to content
Snippets Groups Projects
Commit 16adb425 authored by lecluse's avatar lecluse
Browse files

Utilisation de UnicaenCode

parent 39dfb693
Branches
Tags
No related merge requests found
<?php
use UnicaenCode\Util;
$outputdir = '/tmp/entityInterfaces/';
$sIntrospection = $controller->getServiceLocator()->get('UnicaenCode\Introspection');
/* @var $sIntrospection \UnicaenCode\Service\Introspection */
$sCodeGenerator = $controller->getServiceLocator()->get('UnicaenCode\CodeGenerator');
/* @var $sCodeGenerator \UnicaenCode\Service\CodeGenerator */
$entities = $sIntrospection->getEntities();
$sCodeGenerator->setTemplate('EntityInterface');
foreach( $entities as $entity ){
$entityPath = Util::namespaceClass($entity);
$entityClass = Util::baseClassName($entity);
$entityParam = lcfirst($entityClass);
$sCodeGenerator->setParams( compact('entityPath', 'entityClass', 'entityParam') );
$sCodeGenerator->generateToFile($outputdir, $entityClass.'AwareInterface.php');
}
?>
<h1>Génération des aware interfaces de getters/setters d\'entités</h1>
Résultats dans <b><?php echo $outputdir ?></b>
\ No newline at end of file
<h1>Génération des aware traits de getters/setters d\'entités</h1>
<?php
use UnicaenCode\Util;
$outputdir = '/tmp/entityTraits/';
$sIntrospection = $controller->getServiceLocator()->get('UnicaenCode\Introspection');
/* @var $sIntrospection \UnicaenCode\Service\Introspection */
$sCodeGenerator = $controller->getServiceLocator()->get('UnicaenCode\CodeGenerator');
/* @var $sCodeGenerator \UnicaenCode\Service\CodeGenerator */
$entities = $sIntrospection->getEntities();
$sCodeGenerator->setTemplate('EntityTrait');
foreach( $entities as $entity ){
$entityPath = Util::namespaceClass($entity);
$entityClass = Util::baseClassName($entity);
$entityParam = lcfirst($entityClass);
$sCodeGenerator->setParams( compact('entityPath', 'entityClass', 'entityParam') );
$sCodeGenerator->generateToFile($outputdir, $entityClass.'AwareTrait.php');
}
?>
Résultats dans <b><?php echo $outputdir ?></b>
\ No newline at end of file
<h1>Génération des aware traits d\'accès aux services</h1>
<?php
$outputdir = '/tmp/serviceTraits/';
$sIntrospection = $controller->getServiceLocator()->get('UnicaenCode\Introspection');
/* @var $sIntrospection \UnicaenCode\Service\Introspection */
$sCodeGenerator = $controller->getServiceLocator()->get('UnicaenCode\CodeGenerator');
/* @var $sCodeGenerator \UnicaenCode\Service\CodeGenerator */
$services = $sIntrospection->getServices('Application\\Service\\', 'AbstractService');
$sCodeGenerator->setTemplate('ServiceTrait');
foreach( $services as $entityClass ){
$sCodeGenerator->setParams( compact('entityClass') );
$sCodeGenerator->generateToFile($outputdir, $entityClass.'AwareTrait.php');
}
?>
Résultats dans <b><?php echo $outputdir ?></b>
\ No newline at end of file
<?php
namespace Application\Interfaces;
use <entityPath>\<entityClass>;
/**
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
interface <entityClass>AwareInterface
{
/**
* @param <entityClass> $<entityParam>
* @return self
*/
public function set<entityClass>(<entityClass> $<entityParam> = null);
/**
* @return <entityClass>
*/
public function get<entityClass>();
}
\ No newline at end of file
<?php
namespace Application\Traits;
use <entityPath>\<entityClass>;
/**
* Description of <entityClass>AwareTrait
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
trait <entityClass>AwareTrait
{
/**
* @var <entityClass>
*/
protected $<entityParam>;
/**
* @param <entityClass> $<entityParam>
* @return self
*/
public function set<entityClass>(<entityClass> $<entityParam> = null)
{
$this-><entityParam> = $<entityParam>;
return $this;
}
/**
* @return <entityClass>
*/
public function get<entityClass>()
{
return $this-><entityParam>;
}
}
\ No newline at end of file
<?php
namespace Application\Service\Traits;
use Application\Service\<entityClass>;
use Common\Exception\RuntimeException;
trait <entityClass>AwareTrait
{
/**
* description
*
* @var <entityClass>
*/
private $service<entityClass>;
/**
*
* @param <entityClass> $service<entityClass>
* @return self
*/
public function setService<entityClass>( <entityClass> $service<entityClass> )
{
$this->service<entityClass> = $service<entityClass>;
return $this;
}
/**
*
* @return <entityClass>
* @throws \Common\Exception\RuntimeException
*/
public function getService<entityClass>()
{
if (empty($this->service<entityClass>)){
if (! method_exists($this, 'getServiceLocator')) {
throw new RuntimeException( 'La classe '.get_class($this).' n\'a pas accès au ServiceLocator.');
}
$serviceLocator = $this->getServiceLocator();
if (method_exists($serviceLocator, 'getServiceLocator')) {
$serviceLocator = $serviceLocator->getServiceLocator();
}
return $serviceLocator->get('application<entityClass>');
}else{
return $this->service<entityClass>;
}
}
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"hash": "84e7c075059944efa7196a1b7f16a7a7", "hash": "2e5b200c550fe0380663902466ee4d6e",
"packages": [ "packages": [
{ {
"name": "bjyoungblood/bjy-authorize", "name": "bjyoungblood/bjy-authorize",
...@@ -1175,7 +1175,7 @@ ...@@ -1175,7 +1175,7 @@
"source": { "source": {
"type": "svn", "type": "svn",
"url": "https://svn.unicaen.fr/svn/UnicaenApp", "url": "https://svn.unicaen.fr/svn/UnicaenApp",
"reference": "/trunk/@616" "reference": "/trunk/@617"
}, },
"require": { "require": {
"doctrine/doctrine-orm-module": ">=0.7", "doctrine/doctrine-orm-module": ">=0.7",
...@@ -1273,7 +1273,7 @@ ...@@ -1273,7 +1273,7 @@
}, },
{ {
"name": "zendframework/zend-authentication", "name": "zendframework/zend-authentication",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-authentication.git", "url": "https://github.com/zendframework/zend-authentication.git",
...@@ -1336,7 +1336,7 @@ ...@@ -1336,7 +1336,7 @@
}, },
{ {
"name": "zendframework/zend-cache", "name": "zendframework/zend-cache",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-cache.git", "url": "https://github.com/zendframework/zend-cache.git",
...@@ -1397,7 +1397,7 @@ ...@@ -1397,7 +1397,7 @@
}, },
{ {
"name": "zendframework/zend-code", "name": "zendframework/zend-code",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-code.git", "url": "https://github.com/zendframework/zend-code.git",
...@@ -1450,7 +1450,7 @@ ...@@ -1450,7 +1450,7 @@
}, },
{ {
"name": "zendframework/zend-config", "name": "zendframework/zend-config",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-config.git", "url": "https://github.com/zendframework/zend-config.git",
...@@ -1507,7 +1507,7 @@ ...@@ -1507,7 +1507,7 @@
}, },
{ {
"name": "zendframework/zend-console", "name": "zendframework/zend-console",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-console.git", "url": "https://github.com/zendframework/zend-console.git",
...@@ -1557,7 +1557,7 @@ ...@@ -1557,7 +1557,7 @@
}, },
{ {
"name": "zendframework/zend-crypt", "name": "zendframework/zend-crypt",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-crypt.git", "url": "https://github.com/zendframework/zend-crypt.git",
...@@ -1608,7 +1608,7 @@ ...@@ -1608,7 +1608,7 @@
}, },
{ {
"name": "zendframework/zend-db", "name": "zendframework/zend-db",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-db.git", "url": "https://github.com/zendframework/zend-db.git",
...@@ -1661,7 +1661,7 @@ ...@@ -1661,7 +1661,7 @@
}, },
{ {
"name": "zendframework/zend-escaper", "name": "zendframework/zend-escaper",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-escaper.git", "url": "https://github.com/zendframework/zend-escaper.git",
...@@ -1706,7 +1706,7 @@ ...@@ -1706,7 +1706,7 @@
}, },
{ {
"name": "zendframework/zend-eventmanager", "name": "zendframework/zend-eventmanager",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-eventmanager.git", "url": "https://github.com/zendframework/zend-eventmanager.git",
...@@ -1752,7 +1752,7 @@ ...@@ -1752,7 +1752,7 @@
}, },
{ {
"name": "zendframework/zend-filter", "name": "zendframework/zend-filter",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-filter.git", "url": "https://github.com/zendframework/zend-filter.git",
...@@ -1808,7 +1808,7 @@ ...@@ -1808,7 +1808,7 @@
}, },
{ {
"name": "zendframework/zend-form", "name": "zendframework/zend-form",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-form.git", "url": "https://github.com/zendframework/zend-form.git",
...@@ -1875,7 +1875,7 @@ ...@@ -1875,7 +1875,7 @@
}, },
{ {
"name": "zendframework/zend-http", "name": "zendframework/zend-http",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-http.git", "url": "https://github.com/zendframework/zend-http.git",
...@@ -1925,7 +1925,7 @@ ...@@ -1925,7 +1925,7 @@
}, },
{ {
"name": "zendframework/zend-i18n", "name": "zendframework/zend-i18n",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-i18n.git", "url": "https://github.com/zendframework/zend-i18n.git",
...@@ -1989,7 +1989,7 @@ ...@@ -1989,7 +1989,7 @@
}, },
{ {
"name": "zendframework/zend-inputfilter", "name": "zendframework/zend-inputfilter",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-inputfilter.git", "url": "https://github.com/zendframework/zend-inputfilter.git",
...@@ -2041,7 +2041,7 @@ ...@@ -2041,7 +2041,7 @@
}, },
{ {
"name": "zendframework/zend-json", "name": "zendframework/zend-json",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-json.git", "url": "https://github.com/zendframework/zend-json.git",
...@@ -2095,7 +2095,7 @@ ...@@ -2095,7 +2095,7 @@
}, },
{ {
"name": "zendframework/zend-ldap", "name": "zendframework/zend-ldap",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-ldap.git", "url": "https://github.com/zendframework/zend-ldap.git",
...@@ -2147,7 +2147,7 @@ ...@@ -2147,7 +2147,7 @@
}, },
{ {
"name": "zendframework/zend-loader", "name": "zendframework/zend-loader",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-loader.git", "url": "https://github.com/zendframework/zend-loader.git",
...@@ -2192,7 +2192,7 @@ ...@@ -2192,7 +2192,7 @@
}, },
{ {
"name": "zendframework/zend-log", "name": "zendframework/zend-log",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-log.git", "url": "https://github.com/zendframework/zend-log.git",
...@@ -2254,7 +2254,7 @@ ...@@ -2254,7 +2254,7 @@
}, },
{ {
"name": "zendframework/zend-mail", "name": "zendframework/zend-mail",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-mail.git", "url": "https://github.com/zendframework/zend-mail.git",
...@@ -2309,7 +2309,7 @@ ...@@ -2309,7 +2309,7 @@
}, },
{ {
"name": "zendframework/zend-math", "name": "zendframework/zend-math",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-math.git", "url": "https://github.com/zendframework/zend-math.git",
...@@ -2360,7 +2360,7 @@ ...@@ -2360,7 +2360,7 @@
}, },
{ {
"name": "zendframework/zend-mime", "name": "zendframework/zend-mime",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-mime.git", "url": "https://github.com/zendframework/zend-mime.git",
...@@ -2410,7 +2410,7 @@ ...@@ -2410,7 +2410,7 @@
}, },
{ {
"name": "zendframework/zend-modulemanager", "name": "zendframework/zend-modulemanager",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-modulemanager.git", "url": "https://github.com/zendframework/zend-modulemanager.git",
...@@ -2468,7 +2468,7 @@ ...@@ -2468,7 +2468,7 @@
}, },
{ {
"name": "zendframework/zend-mvc", "name": "zendframework/zend-mvc",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-mvc.git", "url": "https://github.com/zendframework/zend-mvc.git",
...@@ -2555,7 +2555,7 @@ ...@@ -2555,7 +2555,7 @@
}, },
{ {
"name": "zendframework/zend-navigation", "name": "zendframework/zend-navigation",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-navigation.git", "url": "https://github.com/zendframework/zend-navigation.git",
...@@ -2614,7 +2614,7 @@ ...@@ -2614,7 +2614,7 @@
}, },
{ {
"name": "zendframework/zend-paginator", "name": "zendframework/zend-paginator",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-paginator.git", "url": "https://github.com/zendframework/zend-paginator.git",
...@@ -2724,7 +2724,7 @@ ...@@ -2724,7 +2724,7 @@
}, },
{ {
"name": "zendframework/zend-serializer", "name": "zendframework/zend-serializer",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-serializer.git", "url": "https://github.com/zendframework/zend-serializer.git",
...@@ -2777,7 +2777,7 @@ ...@@ -2777,7 +2777,7 @@
}, },
{ {
"name": "zendframework/zend-servicemanager", "name": "zendframework/zend-servicemanager",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-servicemanager.git", "url": "https://github.com/zendframework/zend-servicemanager.git",
...@@ -2827,7 +2827,7 @@ ...@@ -2827,7 +2827,7 @@
}, },
{ {
"name": "zendframework/zend-session", "name": "zendframework/zend-session",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-session.git", "url": "https://github.com/zendframework/zend-session.git",
...@@ -2888,16 +2888,16 @@ ...@@ -2888,16 +2888,16 @@
}, },
{ {
"name": "zendframework/zend-stdlib", "name": "zendframework/zend-stdlib",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-stdlib.git", "url": "https://github.com/zendframework/zend-stdlib.git",
"reference": "a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7" "reference": "d8ecb629a72da9f91bd95c5af006384823560b42"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7", "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/d8ecb629a72da9f91bd95c5af006384823560b42",
"reference": "a5dd7fd2ba6e8f6c6ea5a12db0605d3aa48af1e7", "reference": "d8ecb629a72da9f91bd95c5af006384823560b42",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -2939,11 +2939,11 @@ ...@@ -2939,11 +2939,11 @@
"stdlib", "stdlib",
"zf2" "zf2"
], ],
"time": "2015-05-07 14:55:31" "time": "2015-07-21 13:55:46"
}, },
{ {
"name": "zendframework/zend-uri", "name": "zendframework/zend-uri",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-uri.git", "url": "https://github.com/zendframework/zend-uri.git",
...@@ -2991,7 +2991,7 @@ ...@@ -2991,7 +2991,7 @@
}, },
{ {
"name": "zendframework/zend-validator", "name": "zendframework/zend-validator",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-validator.git", "url": "https://github.com/zendframework/zend-validator.git",
...@@ -3055,16 +3055,16 @@ ...@@ -3055,16 +3055,16 @@
}, },
{ {
"name": "zendframework/zend-version", "name": "zendframework/zend-version",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-version.git", "url": "https://github.com/zendframework/zend-version.git",
"reference": "c02ce68d2c2617cd222c92545d2bf820bb9e0837" "reference": "f5d1b305dee6629b796a1f5307b3243a695abab7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zendframework/zend-version/zipball/c02ce68d2c2617cd222c92545d2bf820bb9e0837", "url": "https://api.github.com/repos/zendframework/zend-version/zipball/f5d1b305dee6629b796a1f5307b3243a695abab7",
"reference": "c02ce68d2c2617cd222c92545d2bf820bb9e0837", "reference": "f5d1b305dee6629b796a1f5307b3243a695abab7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -3101,11 +3101,11 @@ ...@@ -3101,11 +3101,11 @@
"version", "version",
"zf2" "zf2"
], ],
"time": "2015-06-16 21:50:03" "time": "2015-07-21 14:00:02"
}, },
{ {
"name": "zendframework/zend-view", "name": "zendframework/zend-view",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-view.git", "url": "https://github.com/zendframework/zend-view.git",
...@@ -4264,6 +4264,30 @@ ...@@ -4264,6 +4264,30 @@
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2015-07-01 11:25:50" "time": "2015-07-01 11:25:50"
}, },
{
"name": "unicaen/unicaen-code",
"version": "dev-trunk",
"source": {
"type": "svn",
"url": "https://svn.unicaen.fr/svn/UnicaenCode",
"reference": "/trunk/@3"
},
"require-dev": {
"phpunit/phpunit": ">=3.7",
"zendframework/zend-test": ">=2.2"
},
"type": "library",
"autoload": {
"psr-0": {
"UnicaenCode": "src/",
"UnicaenCodeTest": "tests/"
},
"classmap": [
"./Module.php"
]
},
"description": "Boite à outils pour la programmation avec la bibliothèque Unicaen"
},
{ {
"name": "zendframework/zend-debug", "name": "zendframework/zend-debug",
"version": "2.5.1", "version": "2.5.1",
...@@ -4319,12 +4343,12 @@ ...@@ -4319,12 +4343,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/ZendDeveloperTools.git", "url": "https://github.com/zendframework/ZendDeveloperTools.git",
"reference": "d3432681aa32177a741ad23604a40af9ad454acb" "reference": "a3399877d69491acdac86e3aead53937c16b0303"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zendframework/ZendDeveloperTools/zipball/d3432681aa32177a741ad23604a40af9ad454acb", "url": "https://api.github.com/repos/zendframework/ZendDeveloperTools/zipball/a3399877d69491acdac86e3aead53937c16b0303",
"reference": "d3432681aa32177a741ad23604a40af9ad454acb", "reference": "a3399877d69491acdac86e3aead53937c16b0303",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
...@@ -4379,11 +4403,11 @@ ...@@ -4379,11 +4403,11 @@
"module", "module",
"zf2" "zf2"
], ],
"time": "2015-05-06 10:10:04" "time": "2015-07-21 09:14:24"
}, },
{ {
"name": "zendframework/zend-dom", "name": "zendframework/zend-dom",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-dom.git", "url": "https://github.com/zendframework/zend-dom.git",
...@@ -4429,7 +4453,7 @@ ...@@ -4429,7 +4453,7 @@
}, },
{ {
"name": "zendframework/zend-test", "name": "zendframework/zend-test",
"version": "2.4.3", "version": "2.4.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zendframework/zend-test.git", "url": "https://github.com/zendframework/zend-test.git",
...@@ -4494,7 +4518,8 @@ ...@@ -4494,7 +4518,8 @@
"unicaen/unicaen-auth": 20, "unicaen/unicaen-auth": 20,
"unicaen/unicaen-ldap": 20, "unicaen/unicaen-ldap": 20,
"bjyoungblood/bjy-authorize": 20, "bjyoungblood/bjy-authorize": 20,
"zendframework/zend-developer-tools": 20 "zendframework/zend-developer-tools": 20,
"unicaen/unicaen-code": 20
}, },
"prefer-stable": false, "prefer-stable": false,
"prefer-lowest": false, "prefer-lowest": false,
......
...@@ -9,12 +9,12 @@ $modules = [ ...@@ -9,12 +9,12 @@ $modules = [
'UnicaenLdap', 'UnicaenLdap',
'Common', 'Common',
'Application', 'Application',
'Import', 'Import'
//'ZendDeveloperTools'
]; ];
if ( file_exists(dirname(dirname(__FILE__)).'/module/Debug') ) { if ( 'development' == $env ) {
$modules[] = 'Debug'; $modules[] = 'ZendDeveloperTools';
$modules[] = 'UnicaenCode';
} }
return [ return [
......
<?php
$settings = [
'view-dir' => APPLICATION_PATH . '/code',
'template-dir' => APPLICATION_PATH . '/code/template',
];
return [
'unicaen-code' => $settings,
];
\ No newline at end of file
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace Application\Controller; namespace Application\Controller;
use Application\Service\Traits\IntervenantAwareTrait; use Application\Service\Traits\IntervenantAwareTrait;
use UnicaenCode\Util;
use Zend\Mvc\Controller\AbstractActionController; use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel; use Zend\View\Model\ViewModel;
......
...@@ -212,8 +212,6 @@ class Intervenant extends AbstractEntityService ...@@ -212,8 +212,6 @@ class Intervenant extends AbstractEntityService
*/ */
public function importer($sourceCode) public function importer($sourceCode)
{ {
$repo = $this->getEntityManager()->getRepository($this->getEntityClass());
if ($intervenant = $this->getBySourceCode($sourceCode)) { if ($intervenant = $this->getBySourceCode($sourceCode)) {
return $intervenant; return $intervenant;
} }
...@@ -222,6 +220,8 @@ class Intervenant extends AbstractEntityService ...@@ -222,6 +220,8 @@ class Intervenant extends AbstractEntityService
/* @var $import Import */ /* @var $import Import */
$import->intervenant($sourceCode); $import->intervenant($sourceCode);
$repo = $this->getEntityManager()->getRepository($this->getEntityClass());
if (!($intervenant = $repo->findOneBySourceCode($sourceCode))) { if (!($intervenant = $repo->findOneBySourceCode($sourceCode))) {
throw new RuntimeException("Vous n'êtes pas autorisé à vous connecter à OSE avec ce compte. Vous vous prions de vous rapprocher de votre composante pour en obtenir un valide."); throw new RuntimeException("Vous n'êtes pas autorisé à vous connecter à OSE avec ce compte. Vous vous prions de vous rapprocher de votre composante pour en obtenir un valide.");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment