-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathModule.php
63 lines (52 loc) · 1.73 KB
/
Module.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
namespace UserModule;
use PPI\Framework\Module\AbstractModule;
class Module extends AbstractModule
{
protected $name = 'UserModule';
/**
* Get the configuration for this module
*
* @return array
*/
public function getConfig()
{
return $this->loadConfig(__DIR__ . '/resources/config/config.yml');
}
/**
* Get the routes for this module
*
*/
public function getRoutes()
{
return $this->loadSymfonyRoutes(__DIR__ . '/resources/routes/symfony.yml');
}
public function getServiceConfig()
{
return array('factories' => array(
'user.storage' => function ($sm) {
return new \UserModule\Storage\User($sm->get('datasource')->getConnection('main'));
},
'user.security' => function ($sm) {
$us = new \UserModule\Classes\UserSecurity();
$us->setSession($sm->get('session'));
$us->setUserStorage($sm->get('user.storage'));
$us->setConfig($sm->get('config'));
return $us;
},
'login.helper' => function ($sm) {
$us = new \UserModule\Classes\UserSecurity();
$us->setSession($sm->get('session'));
return $us;
},
'user.security.templating.helper' => function ($sm) {
return new \UserModule\Classes\UserSecurityTemplatingHelper($sm->get('user.security'));
},
'user.account.helper' => function ($sm) {
$helper = new \UserModule\Classes\AccountHelper();
$helper->setUserStorage($sm->get('user.storage'));
return $helper;
}
));
}
}