Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
app
Commits
44f5e0a7
Commit
44f5e0a7
authored
Mar 10, 2019
by
Bertrand Gauthier
Browse files
Corrections pour passer à ZF3.
parent
dc5c6458
Changes
91
Hide whitespace changes
Inline
Side-by-side
Module.php
View file @
44f5e0a7
<?php
namespace
UnicaenApp
;
use
UnicaenApp\Mouchard\MouchardService
;
use
UnicaenApp\Mouchard\MouchardServiceFactory
;
use
Locale
;
use
UnicaenApp\Controller\Plugin\MessengerPluginFactory
;
use
UnicaenApp\Controller\Plugin\Upload\UploaderPluginFactory
;
use
UnicaenApp\Mvc\Listener\MaintenanceListener
;
use
UnicaenApp\Mvc\Listener\ModalListener
;
use
UnicaenApp\Mvc\View\Http\ExceptionStrategy
;
use
UnicaenApp\Options\ModuleOptions
;
use
Zend\Console\Request
as
ConsoleRequest
;
use
Zend\EventManager\EventInterface
;
use
Zend\Http\Request
as
HttpRequest
;
use
Zend\
ServiceManager\ServiceManage
r
;
use
Zend\
Mvc\I18n\Translato
r
;
use
Zend\ModuleManager\Feature\AutoloaderProviderInterface
;
use
Zend\ModuleManager\Feature\BootstrapListenerInterface
;
use
Zend\ModuleManager\Feature\ConfigProviderInterface
;
use
Zend\ModuleManager\Feature\ControllerPluginProviderInterface
;
use
Zend\ModuleManager\Feature\ServiceProviderInterface
;
use
Zend\Console\Request
as
ConsoleRequest
;
use
Zend\Mvc\Console\View\ExceptionStrategy
as
ConsoleExceptionStrategy
;
use
Zend\Mvc\View\Http\ExceptionStrategy
as
HttpExceptionStrategy
;
use
Zend\ServiceManager\ServiceManager
;
use
Zend\Validator\AbstractValidator
;
use
Zend\Mvc\I18n\Translator
;
use
Locale
;
use
UnicaenApp\Mvc\View\Http\ExceptionStrategy
;
use
UnicaenApp\Mvc\Listener\ModalListener
;
use
Zend\View\Helper\Navigation
;
use
Zend\View\HelperPluginManager
;
use
Zend\Mvc\View\Http\ExceptionStrategy
as
HttpExceptionStrategy
;
use
Zend\Mvc\View\Console\ExceptionStrategy
as
ConsoleExceptionStrategy
;
define
(
'__VENDOR_DIR__'
,
dirname
(
dirname
(
__DIR__
)));
...
...
@@ -85,6 +86,7 @@ class Module implements
$this
->
bootstrapSession
(
$e
);
// la locale par défaut est celle du service de traduction
/** @var \Zend\I18n\Translator\Translator $translator */
$translator
=
$services
->
get
(
'translator'
);
Locale
::
setDefault
(
$translator
->
getLocale
());
...
...
@@ -106,10 +108,11 @@ class Module implements
$services
->
get
(
'MouchardService'
)
->
createMouchardsFromConfig
();
/* @var $vhm HelperPluginManager */
$vhm
=
$services
->
get
(
'
v
iew
_h
elper
_m
anager'
);
$vhm
=
$services
->
get
(
'
V
iew
H
elper
M
anager'
);
/* @var $nvh Navigation */
$nvh
=
$vhm
->
get
(
'navigation'
);
$nvh
=
$vhm
->
get
(
'Zend\View\Helper\Navigation'
);
$nvh
->
setServiceLocator
(
$services
);
// Déclaration des plugins maison pour l'aide de vue de navigation
$invokables
=
array
(
'menuPrincipal'
=>
'UnicaenApp\View\Helper\Navigation\MenuPrincipal'
,
...
...
@@ -123,7 +126,7 @@ class Module implements
$nvh
->
getPluginManager
()
->
setInvokableClass
(
$key
,
$value
);
}
$eventManager
->
attach
(
new
ModalListener
()
);
(
new
ModalListener
())
->
attach
(
$eventManager
);
/** @var ModuleOptions $moduleOptions */
$moduleOptions
=
$services
->
get
(
'unicaen-app_module_options'
);
...
...
@@ -200,14 +203,14 @@ class Module implements
'ldapGroupService'
=>
'UnicaenApp\Controller\Plugin\LdapGroupServiceFactory'
,
'mail'
=>
'UnicaenApp\Controller\Plugin\MailFactory'
,
'appInfos'
=>
'UnicaenApp\Controller\Plugin\AppInfosFactory'
,
'uploader'
=>
UploaderPluginFactory
::
class
,
'messenger'
=>
MessengerPluginFactory
::
class
,
),
'invokables'
=>
array
(
'multipageForm'
=>
'UnicaenApp\Controller\Plugin\MultipageForm'
,
'modalInnerViewModel'
=>
'UnicaenApp\Controller\Plugin\ModalInnerViewModel'
,
'popoverInnerViewModel'
=>
'UnicaenApp\Controller\Plugin\PopoverInnerViewModel'
,
'uploader'
=>
'UnicaenApp\Controller\Plugin\Upload\UploaderPlugin'
,
'confirm'
=>
'UnicaenApp\Controller\Plugin\ConfirmPlugin'
,
'messenger'
=>
'UnicaenApp\Controller\Plugin\MessengerPlugin'
,
),
);
}
...
...
composer.json
View file @
44f5e0a7
...
...
@@ -4,15 +4,18 @@
"require"
:
{
"php"
:
">=5.6 || >=7.0"
,
"ext-bcmath"
:
"*"
,
"ext-intl"
:
"*"
,
"ext-ldap"
:
"*"
,
"
zendframework/zend-http
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-mvc
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-mvc-i18n
"
:
"
^1.1
"
,
"
zendframework/zend-eventmanager
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-servicemanager
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-view
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-mail
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-session
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-i18n
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-i18n-resources
"
:
"
^2.6
"
,
"
zendframework/zend-navigation
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-version
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-ldap
"
:
"^2.4 || ^3.0"
,
...
...
@@ -21,10 +24,12 @@
"
zendframework/zend-config
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-serializer
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-json
"
:
"^2.4 || ^3.0"
,
"
zendframework/zend-mvc-console
"
:
"
^1.2
"
,
"
doctrine/doctrine-orm-module
"
:
"
*
"
,
"
mpdf/mpdf
"
:
"
v6.1.3
"
},
"require-dev"
:
{
"
zfcampus/zf-asset-manager
"
:
"
^1.2
"
,
"
zendframework/zend-test
"
:
"^2.4 || ^3.0"
,
"
phpunit/phpunit
"
:
"
^5.6
"
},
...
...
config/module.config.php
View file @
44f5e0a7
...
...
@@ -3,9 +3,18 @@
namespace
UnicaenApp
;
use
UnicaenApp\Controller\CacheControllerFactory
;
use
UnicaenApp\Controller\InstadiaControllerFactory
;
use
UnicaenApp\Mouchard\HistoriqueListenerFactory
;
use
UnicaenApp\Service\InstadiaServiceFactory
;
use
UnicaenApp\Service\Mailer\MailerService
;
use
UnicaenApp\Service\Mailer\MailerServiceFactory
;
use
UnicaenApp\ServiceManager\ServiceLocatorAwareInitializer
;
use
UnicaenApp\View\Helper\HeadLinkFactory
;
use
UnicaenApp\View\Helper\HeadScriptFactory
;
use
UnicaenApp\View\Helper\InlineScriptFactory
;
use
UnicaenApp\View\Helper\InstadiaViewHelperFactory
;
use
UnicaenApp\View\Helper\MessageCollectorHelperFactory
;
use
UnicaenApp\View\Helper\Upload\UploaderHelperFactory
;
return
[
'asset_manager'
=>
[
...
...
@@ -20,7 +29,7 @@ return [
// Base “route”, which describes the base match needed, the root of the tree
'home'
=>
[
// The Literal route is for doing exact matching of the URI path
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/'
,
'defaults'
=>
[
...
...
@@ -31,7 +40,7 @@ return [
],
// A propos
'apropos'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/apropos'
,
'defaults'
=>
[
...
...
@@ -43,7 +52,7 @@ return [
],
// Contact
'contact'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/contact'
,
'defaults'
=>
[
...
...
@@ -55,7 +64,7 @@ return [
],
// Plan de navigation
'plan'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/plan'
,
'defaults'
=>
[
...
...
@@ -67,7 +76,7 @@ return [
],
// Mentions légales
'mentions-legales'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/mentions-legales'
,
'defaults'
=>
[
...
...
@@ -79,7 +88,7 @@ return [
],
// Informatique et libertés
'il'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/informatique-et-libertes'
,
'defaults'
=>
[
...
...
@@ -91,7 +100,7 @@ return [
],
// Rafraîchissement de la session
'refresh-session'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/refresh-session'
,
'defaults'
=>
[
...
...
@@ -133,7 +142,7 @@ return [
],
],
'cache'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Literal'
,
'type'
=>
'Literal'
,
'options'
=>
[
'route'
=>
'/cache'
,
'defaults'
=>
[
...
...
@@ -143,7 +152,7 @@ return [
'may_terminate'
=>
false
,
'child_routes'
=>
[
'js'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Segment'
,
'type'
=>
'Segment'
,
'options'
=>
[
'route'
=>
'/js[/:version]'
,
'defaults'
=>
[
...
...
@@ -153,7 +162,7 @@ return [
'may_terminate'
=>
true
,
],
'css'
=>
[
'type'
=>
'
Zend\Mvc\Router\Http\
Segment'
,
'type'
=>
'Segment'
,
'options'
=>
[
'route'
=>
'/css[/:version]'
,
'defaults'
=>
[
...
...
@@ -259,6 +268,9 @@ return [
'MouchardCompleterMvc'
=>
'UnicaenApp\Mouchard\MouchardCompleterMvcFactory'
,
MailerService
::
class
=>
MailerServiceFactory
::
class
,
'UnicaenApp\HistoriqueListener'
=>
HistoriqueListenerFactory
::
class
,
'instadia'
=>
InstadiaServiceFactory
::
class
,
],
'shared'
=>
[
'MouchardListenerErrorHandler'
=>
false
,
...
...
@@ -271,8 +283,6 @@ return [
'MouchardCompleterMvc'
=>
false
,
],
'invokables'
=>
[
'UnicaenApp\HistoriqueListener'
=>
'UnicaenApp\ORM\Event\Listeners\HistoriqueListener'
,
'instadia'
=>
'UnicaenApp\Service\InstadiaService'
,
],
'abstract_factories'
=>
[
// 'UnicaenApp\Service\Doctrine\MultipleDbAbstractFactory',
...
...
@@ -307,6 +317,12 @@ return [
'messenger'
=>
'UnicaenApp\View\Helper\MessengerFactory'
,
'queryParams'
=>
View\Helper\QueryParamsHelperFactory
::
class
,
'formControlGroup'
=>
Form\View\Helper\FormControlGroupFactory
::
class
,
'headLink'
=>
HeadLinkFactory
::
class
,
'headScript'
=>
HeadScriptFactory
::
class
,
'inlineScript'
=>
InlineScriptFactory
::
class
,
'instadia'
=>
InstadiaViewHelperFactory
::
class
,
'messageCollector'
=>
MessageCollectorHelperFactory
::
class
,
'Uploader'
=>
UploaderHelperFactory
::
class
,
],
'invokables'
=>
[
'appConnection'
=>
'UnicaenApp\View\Helper\AppConnection'
,
...
...
@@ -325,17 +341,10 @@ return [
'formLdapPeople'
=>
'UnicaenApp\Form\View\Helper\FormLdapPeople'
,
'formErrors'
=>
'UnicaenApp\Form\View\Helper\FormErrors'
,
'form'
=>
'UnicaenApp\Form\View\Helper\Form'
,
'messageCollector'
=>
'UnicaenApp\View\Helper\MessageCollectorHelper'
,
/* Nouvelles aides de vue qui surchargent les anciennent pour exploiter des directives de configuration */
'headScript'
=>
'UnicaenApp\View\Helper\HeadScript'
,
'inlineScript'
=>
'UnicaenApp\View\Helper\InlineScript'
,
'headLink'
=>
'UnicaenApp\View\Helper\HeadLink'
,
'Uploader'
=>
'UnicaenApp\View\Helper\Upload\UploaderHelper'
,
'formAdvancedMultiCheckbox'
=>
'UnicaenApp\Form\View\Helper\FormAdvancedMultiCheckbox'
,
'historique'
=>
'UnicaenApp\View\Helper\HistoriqueViewHelper'
,
'tabajax'
=>
'UnicaenApp\View\Helper\TabAjax\TabAjaxViewHelper'
,
'tag'
=>
'UnicaenApp\View\Helper\TagViewHelper'
,
'instadia'
=>
'UnicaenApp\View\Helper\InstadiaViewHelper'
,
],
'initializers'
=>
[
'UnicaenApp\Service\EntityManagerAwareInitializer'
,
...
...
@@ -364,13 +373,13 @@ return [
'controllers'
=>
[
'invokables'
=>
[
'UnicaenApp\Controller\Application'
=>
'UnicaenApp\Controller\ApplicationController'
,
'UnicaenApp\Controller\Instadia'
=>
'UnicaenApp\Controller\InstadiaController'
,
],
'initializers'
=>
[
'UnicaenApp\Service\EntityManagerAwareInitializer'
,
],
'factories'
=>
[
'UnicaenApp\Controller\Cache'
=>
CacheControllerFactory
::
class
,
'UnicaenApp\Controller\Instadia'
=>
InstadiaControllerFactory
::
class
,
]
],
'doctrine'
=>
[
...
...
src/UnicaenApp/Controller/ApplicationController.php
View file @
44f5e0a7
...
...
@@ -40,35 +40,6 @@ class ApplicationController extends AbstractActionController
exit
;
}
// public function menuSecondaireAction()
// {
// $pagesConfig = $this->getServiceLocator()->get('config')['navigation']['default'];
// $container = new Navigation($pagesConfig);
//
// $json = $this->params()->fromQuery('route-match');
// $routeMatchElements = Json::decode($json, Json::TYPE_ARRAY);
// $routeMatchElements = [
// '__NAMESPACE__' => 'Application\Controller',
// 'controller' => 'Application\Controller\These',
// 'action' => 'identite',
// 'these' => '28498',
// '__CONTROLLER__' => 'These',
// 'matchedRouteName' => 'these/identite'
// ];
//
// $matchedRouteName = $routeMatchElements['matchedRouteName'];
// unset($routeMatchElements['matchedRouteName']);
// $routeMatch = new RouteMatch($routeMatchElements);
// $routeMatch->setMatchedRouteName($matchedRouteName);
//
// var_dump($routeMatchElements, $routeMatch);
//
// return [
// 'routeMatch' => $routeMatch,
// 'container' => $container,
// ];
// }
public
function
testEnvoiMailAction
()
{
$app
=
$this
->
appInfos
()
->
getNom
();
...
...
src/UnicaenApp/Controller/CacheController.php
View file @
44f5e0a7
<?php
namespace
UnicaenApp\Controller
;
use
UnicaenApp\ServiceManager\ServiceLocatorAwareInterface
;
use
Zend\Http\Header\CacheControl
;
use
Zend\Http\Header\ContentType
;
use
Zend\Http\Header\Expires
;
use
Zend\Http\Header\Pragma
;
use
Zend\Mvc\Controller\AbstractActionController
;
use
Zend\ServiceManager\ServiceLocatorAwareTrait
;
use
Zend\Stdlib\ResponseInterface
as
Response
;
...
...
@@ -15,9 +13,17 @@ use Zend\Stdlib\ResponseInterface as Response;
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class
CacheController
extends
AbstractActionController
implements
ServiceLocatorAwareInterface
class
CacheController
extends
AbstractActionController
{
use
ServiceLocatorAwareTrait
;
private
$config
=
[];
/**
* @param array $config
*/
public
function
setConfig
(
array
$config
)
{
$this
->
config
=
$config
;
}
public
function
jsAction
()
{
...
...
@@ -88,7 +94,7 @@ class CacheController extends AbstractActionController implements ServiceLocator
{
$files
=
[];
$config
=
$this
->
getServiceLocator
()
->
get
(
'
config
'
)
;
$config
=
$this
->
config
;
$publicFiles
=
isset
(
$config
[
'public_files'
])
?
$config
[
'public_files'
]
:
[];
$jsFiles
=
isset
(
$publicFiles
[
'inline_scripts'
])
?
$publicFiles
[
'inline_scripts'
]
:
[];
...
...
@@ -108,7 +114,7 @@ class CacheController extends AbstractActionController implements ServiceLocator
{
$files
=
[];
$config
=
$this
->
getServiceLocator
()
->
get
(
'
config
'
)
;
$config
=
$this
->
config
;
$publicFiles
=
isset
(
$config
[
'public_files'
])
?
$config
[
'public_files'
]
:
[];
$cssFiles
=
isset
(
$publicFiles
[
'stylesheets'
])
?
$publicFiles
[
'stylesheets'
]
:
[];
...
...
src/UnicaenApp/Controller/CacheControllerFactory.php
View file @
44f5e0a7
...
...
@@ -14,8 +14,7 @@ class CacheControllerFactory
{
$controller
=
new
CacheController
();
// todo: abandonner l'injection du service locator, svp!
$controller
->
setServiceLocator
(
$cm
->
getServiceLocator
());
$controller
->
setConfig
(
$cm
->
get
(
'config'
));
return
$controller
;
}
...
...
src/UnicaenApp/Controller/InstadiaControllerFactory.php
0 → 100644
View file @
44f5e0a7
<?php
namespace
UnicaenApp\Controller
;
use
UnicaenApp\Service\InstadiaService
;
use
Zend\Mvc\Controller\ControllerManager
;
class
InstadiaControllerFactory
{
/**
* @param ControllerManager $cm
* @return InstadiaController
*/
public
function
__invoke
(
ControllerManager
$cm
)
{
$controller
=
new
InstadiaController
();
/** @var InstadiaService $instadiaService */
$instadiaService
=
$cm
->
get
(
'instadia'
);
$controller
->
setServiceInstadia
(
$instadiaService
);
return
$controller
;
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/AppInfosFactory.php
View file @
44f5e0a7
...
...
@@ -2,6 +2,8 @@
namespace
UnicaenApp\Controller\Plugin
;
use
Interop\Container\ContainerInterface
;
use
UnicaenApp\Options\ModuleOptions
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,16 +14,15 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
AppInfosFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $helperPluginManager
* @return AppInfos
*/
public
function
createService
(
ServiceLocatorInterface
$helperPluginManager
)
{
$options
=
$helperPluginManager
->
getServiceLocator
()
->
get
(
'unicaen-app_module_options'
);
/* @var $options ModuleOptions */
return
$this
->
__invoke
(
$helperPluginManager
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
$options
=
$container
->
get
(
'unicaen-app_module_options'
);
/* @var $options ModuleOptions */
return
new
AppInfos
(
$options
->
getAppInfos
());
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/ConfirmPlugin.php
View file @
44f5e0a7
...
...
@@ -4,8 +4,6 @@ namespace UnicaenApp\Controller\Plugin;
use
UnicaenApp\Form\Confirmer
;
use
Zend\Mvc\Controller\Plugin\AbstractPlugin
;
use
Zend\Mvc\Controller\Plugin\Params
;
use
Zend\Mvc\Controller\Plugin\Url
;
use
Zend\View\Model\ViewModel
;
/**
...
...
src/UnicaenApp/Controller/Plugin/LdapGroupServiceFactory.php
View file @
44f5e0a7
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenApp\Controller\Plugin
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,14 +13,13 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
LdapGroupServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $pluginManager
* @return LdapGroupService
*/
public
function
createService
(
ServiceLocatorInterface
$pluginManager
)
{
return
new
LdapGroupService
(
$pluginManager
->
getServiceLocator
()
->
get
(
'ldap_group_service'
));
return
$this
->
__invoke
(
$pluginManager
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
return
new
LdapGroupService
(
$container
->
get
(
'ldap_group_service'
));
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/LdapPeopleServiceFactory.php
View file @
44f5e0a7
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenApp\Controller\Plugin
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,14 +13,13 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
LdapPeopleServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $pluginManager
* @return LdapPeopleService
*/
public
function
createService
(
ServiceLocatorInterface
$pluginManager
)
{
return
new
LdapPeopleService
(
$pluginManager
->
getServiceLocator
()
->
get
(
'ldap_people_service'
));
return
$this
->
__invoke
(
$pluginManager
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
return
new
LdapPeopleService
(
$container
->
get
(
'ldap_people_service'
));
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/LdapStructureServiceFactory.php
View file @
44f5e0a7
...
...
@@ -2,6 +2,7 @@
namespace
UnicaenApp\Controller\Plugin
;
use
Interop\Container\ContainerInterface
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;
...
...
@@ -12,14 +13,13 @@ use Zend\ServiceManager\ServiceLocatorInterface;
*/
class
LdapStructureServiceFactory
implements
FactoryInterface
{
/**
* Create service
*
* @param ServiceLocatorInterface $pluginManager
* @return LdapStructureService
*/
public
function
createService
(
ServiceLocatorInterface
$pluginManager
)
{
return
new
LdapStructureService
(
$pluginManager
->
getServiceLocator
()
->
get
(
'ldap_structure_service'
));
return
$this
->
__invoke
(
$pluginManager
,
'?'
);
}
public
function
__invoke
(
ContainerInterface
$container
,
$requestedName
,
array
$options
=
null
)
{
return
new
LdapStructureService
(
$container
->
get
(
'ldap_structure_service'
));
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/MailFactory.php
View file @
44f5e0a7
...
...
@@ -19,7 +19,7 @@ class MailFactory
public
function
__invoke
(
PluginManager
$pluginManager
)
{
/** @var MailerService $mailerService */
$mailerService
=
$pluginManager
->
getServiceLocator
()
->
get
(
MailerService
::
class
);
$mailerService
=
$pluginManager
->
get
(
MailerService
::
class
);
$plugin
=
new
Mail
();
$plugin
->
setMailerService
(
$mailerService
);
...
...
src/UnicaenApp/Controller/Plugin/MessengerPlugin.php
View file @
44f5e0a7
...
...
@@ -4,8 +4,6 @@ namespace UnicaenApp\Controller\Plugin;
use
UnicaenApp\Traits\MessageAwareInterface
;
use
UnicaenApp\Traits\MessageAwareTrait
;
use
UnicaenApp\View\Helper\Messenger
as
MessengerViewHelper
;
use
UnicaenApp\ServiceManager\ServiceLocatorAwareInterface
;
use
Zend\ServiceManager\ServiceLocatorAwareTrait
;
use
Zend\Mvc\Controller\Plugin\AbstractPlugin
;
/**
...
...
@@ -16,9 +14,8 @@ use Zend\Mvc\Controller\Plugin\AbstractPlugin;
*
* @author Bertrand GAUTHIER <bertrand.gauthier@unicaen.fr>
*/
class
MessengerPlugin
extends
AbstractPlugin
implements
ServiceLocatorAwareInterface
,
MessageAwareInterface
class
MessengerPlugin
extends
AbstractPlugin
implements
MessageAwareInterface
{
use
ServiceLocatorAwareTrait
;
use
MessageAwareTrait
;
/**
...
...
@@ -27,27 +24,20 @@ class MessengerPlugin extends AbstractPlugin implements ServiceLocatorAwareInter
protected
$messengerViewHelper
;
/**
* Helper entry point.
*
* @return MessengerViewHelper
* @param MessengerViewHelper $messengerViewHelper
*/
public
function
__invoke
(
)
public
function
setMessengerViewHelper
(
MessengerViewHelper
$messengerViewHelper
)
{
return
$this
->
getM
essengerViewHelper
()
;
$this
->
messengerViewHelper
=
$m
essengerViewHelper
;
}
/**
* Helper entry point.
*
* @return MessengerViewHelper
*/
p
rivate
function
getMessengerViewHelper
()
p
ublic
function
__invoke
()
{
if
(
null
===
$this
->
messengerViewHelper
)
{
$sl
=
$this
->
getServiceLocator
()
->
getServiceLocator
();
$this
->
messengerViewHelper
=
$sl
->
get
(
'viewhelpermanager'
)
->
get
(
'messenger'
);
}
return
$this
->
messengerViewHelper
;
}
}
\ No newline at end of file
src/UnicaenApp/Controller/Plugin/MessengerPluginFactory.php
0 → 100644
View file @
44f5e0a7
<?php
namespace
UnicaenApp\Controller\Plugin
;
use
Interop\Container\ContainerInterface
;
use
UnicaenApp\View\Helper\Messenger
;
use
Zend\ServiceManager\FactoryInterface
;
use
Zend\ServiceManager\ServiceLocatorInterface
;