diff --git a/ZendSkeletonApplication-master/module/User/config/module.config.php b/ZendSkeletonApplication-master/module/User/config/module.config.php index 04997a7ea2df54505b25e6470481096069d9fe2d..91f7f9753cf66de9aad938142fcb681ba27d4d44 100644 --- a/ZendSkeletonApplication-master/module/User/config/module.config.php +++ b/ZendSkeletonApplication-master/module/User/config/module.config.php @@ -21,11 +21,26 @@ return [ ], ], ], + 'connexion' => [ + 'type' => Segment::class, + 'options' => [ + 'route' => '/connexion[/:action[/:id]]', + 'constraints' => [ + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'id' => '[0-9]+', + ], + 'defaults' => [ + 'controller' => Controller\ConnexionController::class, + 'action' => 'index', + ], + ], + ], ], ], 'view_manager' => [ 'template_path_stack' => [ 'user' => __DIR__ . '/../view', + 'connexion' => __DIR__ . '/../view', ], ], ]; ?> diff --git a/ZendSkeletonApplication-master/module/User/src/Controller/ConnexionController.php b/ZendSkeletonApplication-master/module/User/src/Controller/ConnexionController.php index 9cdefc8b3024aa7cc13e5a055d2199d20d3c34d5..1cf501df8dfa89750a2c04224c8460a9804b1df0 100644 --- a/ZendSkeletonApplication-master/module/User/src/Controller/ConnexionController.php +++ b/ZendSkeletonApplication-master/module/User/src/Controller/ConnexionController.php @@ -1,11 +1,11 @@ <?php namespace User\Controller; -use User\Model\UserTable; +use User\Model\ConnexionTable; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; -class UserController extends AbstractActionController +class ConnexionController extends AbstractActionController { // Add this property: private $table; @@ -19,7 +19,7 @@ class UserController extends AbstractActionController public function indexAction() { return new ViewModel([ - 'users' => $this->table->fetchAll(), + 'connexions' => $this->table->fetchAll(), ]); } diff --git a/ZendSkeletonApplication-master/module/User/src/Model/ConnexionTable.php b/ZendSkeletonApplication-master/module/User/src/Model/ConnexionTable.php index a3439d7ff2b173d0118fe6346519bc95836fe5de..caf08357b7a07c0972f9836d94b7017e4ad27338 100644 --- a/ZendSkeletonApplication-master/module/User/src/Model/ConnexionTable.php +++ b/ZendSkeletonApplication-master/module/User/src/Model/ConnexionTable.php @@ -1,5 +1,5 @@ <?php -namespace Connexion\Model; +namespace User\Model; use RuntimeException; use Zend\Db\TableGateway\TableGatewayInterface; diff --git a/ZendSkeletonApplication-master/module/User/src/Module.php b/ZendSkeletonApplication-master/module/User/src/Module.php index bbce0337ceea45a75cfd77ea11fa1263e4d46fc3..f41509221fd44cc78b8a74ee072ce284b6299bbe 100644 --- a/ZendSkeletonApplication-master/module/User/src/Module.php +++ b/ZendSkeletonApplication-master/module/User/src/Module.php @@ -27,6 +27,16 @@ class Module implements ConfigProviderInterface $resultSetPrototype->setArrayObjectPrototype(new Model\User()); return new TableGateway('users', $dbAdapter, null, $resultSetPrototype); }, + Model\ConnexionTable::class => function($container) { + $tableGateway = $container->get(Model\ConnexionTableGateway::class); + return new Model\ConnexionTable($tableGateway); + }, + Model\ConnexionTableGateway::class => function ($container) { + $dbAdapter = $container->get(AdapterInterface::class); + $resultSetPrototype = new ResultSet(); + $resultSetPrototype->setArrayObjectPrototype(new Model\Connexion()); + return new TableGateway('connexions', $dbAdapter, null, $resultSetPrototype); + }, ], ]; } @@ -40,6 +50,11 @@ class Module implements ConfigProviderInterface $container->get(Model\UserTable::class) ); }, + Controller\ConnexionController::class => function($container) { + return new Controller\ConnexionController( + $container->get(Model\ConnexionTable::class) + ); + }, ], ]; }