Loading Module.php 0 → 100755 +55 −0 Original line number Diff line number Diff line <?php namespace Enquete; use Laminas\Config\Factory as ConfigFactory; use Laminas\Http\Request as HttpRequest; use Laminas\Mvc\ModuleRouteListener; use Laminas\Mvc\MvcEvent; use Laminas\Stdlib\ArrayUtils; use Laminas\Stdlib\Glob; class Module { public function onBootstrap(MvcEvent $e) { $e->getApplication()->getServiceManager()->get('translator'); $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); /* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */ $eventManager->getSharedManager()->attach('Laminas\Mvc\Controller\AbstractActionController', 'dispatch', function (MvcEvent $e) { $request = $e->getRequest(); if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) { $e->getTarget()->layout('layout/ajax.phtml'); } } ); } public function getConfig() { $configInit = [ __DIR__ . '/config/module.config.php' ]; $configFiles = ArrayUtils::merge( $configInit, Glob::glob(__DIR__ . '/config/merged/{,*.}{config}.php', Glob::GLOB_BRACE) ); return ConfigFactory::fromFiles($configFiles); } public function getAutoloaderConfig() { return array( 'Laminas\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/', ), ), ); } } config/module.config.php 0 → 100755 +61 −0 Original line number Diff line number Diff line <?php use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; return array( 'doctrine' => [ 'driver' => [ 'orm_default' => [ 'class' => MappingDriverChain::class, 'drivers' => [ 'Enquete\Entity\Db' => 'orm_default_xml_driver', ], ], 'orm_default_xml_driver' => [ 'class' => XmlDriver::class, 'cache' => 'apc', 'paths' => [ __DIR__ . '/../src/Entity/Db/Mapping', ], ], ], 'cache' => [ 'apc' => [ 'namespace' => 'MCP__' . __NAMESPACE__, ], ], ], 'router' => [ 'routes' => [ ], ], 'service_manager' => [ 'factories' => [ ], ], 'form_elements' => [ 'factories' => [ ], ], 'hydrators' => [ 'invokables' => [ ], ], 'controllers' => [ 'factories' => [ ], ], 'view_helpers' => [ 'invokables' => [ ], ], 'view_manager' => [ 'template_path_stack' => [ __DIR__ . '/../view', ], ], ); Loading
Module.php 0 → 100755 +55 −0 Original line number Diff line number Diff line <?php namespace Enquete; use Laminas\Config\Factory as ConfigFactory; use Laminas\Http\Request as HttpRequest; use Laminas\Mvc\ModuleRouteListener; use Laminas\Mvc\MvcEvent; use Laminas\Stdlib\ArrayUtils; use Laminas\Stdlib\Glob; class Module { public function onBootstrap(MvcEvent $e) { $e->getApplication()->getServiceManager()->get('translator'); $eventManager = $e->getApplication()->getEventManager(); $moduleRouteListener = new ModuleRouteListener(); $moduleRouteListener->attach($eventManager); /* Active un layout spécial si la requête est de type AJAX. Valable pour TOUS les modules de l'application. */ $eventManager->getSharedManager()->attach('Laminas\Mvc\Controller\AbstractActionController', 'dispatch', function (MvcEvent $e) { $request = $e->getRequest(); if ($request instanceof HttpRequest && $request->isXmlHttpRequest()) { $e->getTarget()->layout('layout/ajax.phtml'); } } ); } public function getConfig() { $configInit = [ __DIR__ . '/config/module.config.php' ]; $configFiles = ArrayUtils::merge( $configInit, Glob::glob(__DIR__ . '/config/merged/{,*.}{config}.php', Glob::GLOB_BRACE) ); return ConfigFactory::fromFiles($configFiles); } public function getAutoloaderConfig() { return array( 'Laminas\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/', ), ), ); } }
config/module.config.php 0 → 100755 +61 −0 Original line number Diff line number Diff line <?php use Doctrine\ORM\Mapping\Driver\XmlDriver; use Doctrine\Persistence\Mapping\Driver\MappingDriverChain; return array( 'doctrine' => [ 'driver' => [ 'orm_default' => [ 'class' => MappingDriverChain::class, 'drivers' => [ 'Enquete\Entity\Db' => 'orm_default_xml_driver', ], ], 'orm_default_xml_driver' => [ 'class' => XmlDriver::class, 'cache' => 'apc', 'paths' => [ __DIR__ . '/../src/Entity/Db/Mapping', ], ], ], 'cache' => [ 'apc' => [ 'namespace' => 'MCP__' . __NAMESPACE__, ], ], ], 'router' => [ 'routes' => [ ], ], 'service_manager' => [ 'factories' => [ ], ], 'form_elements' => [ 'factories' => [ ], ], 'hydrators' => [ 'invokables' => [ ], ], 'controllers' => [ 'factories' => [ ], ], 'view_helpers' => [ 'invokables' => [ ], ], 'view_manager' => [ 'template_path_stack' => [ __DIR__ . '/../view', ], ], );