1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace DoS\UserBundle\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use DoS\ResourceBundle\DependencyInjection\AbstractResourceExtension; |
6
|
|
|
use Symfony\Component\Config\Definition\ConfigurationInterface; |
7
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
8
|
|
|
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; |
9
|
|
|
|
10
|
|
|
class DoSUserExtension extends AbstractResourceExtension implements PrependExtensionInterface |
11
|
|
|
{ |
12
|
|
|
/** |
13
|
|
|
* {@inheritdoc} |
14
|
|
|
*/ |
15
|
|
|
protected function getBundleConfiguration() |
16
|
|
|
{ |
17
|
|
|
return new Configuration(); |
18
|
|
|
} |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* {@inheritdoc} |
22
|
|
|
*/ |
23
|
|
|
public function load(array $config, ContainerBuilder $container) |
24
|
|
|
{ |
25
|
|
|
$config = parent::load($config, $container); |
26
|
|
|
|
27
|
|
|
$container->setParameter('dos.user.confirmation', $config['confirmation']); |
28
|
|
|
$container->setParameter('dos.user.confirmation.actived', $config['confirmation']['actived']); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* {@inheritdoc} |
33
|
|
|
*/ |
34
|
|
|
public function prepend(ContainerBuilder $container) |
35
|
|
|
{ |
36
|
|
|
$this->processConfiguration(new Configuration(), $container->getExtensionConfig($this->getAlias())); |
37
|
|
|
|
38
|
|
|
$container->prependExtensionConfig('sylius_user', array( |
39
|
|
|
'resources' => array( |
40
|
|
|
'customer' => array( |
41
|
|
|
'classes' => array( |
42
|
|
|
'model' => 'DoS\UserBundle\Model\Customer', |
43
|
|
|
'repository' => 'DoS\ResourceBundle\Doctrine\ORM\EntityRepository', |
44
|
|
|
'form' => array( |
45
|
|
|
'default' => 'DoS\UserBundle\Form\Type\CustomerType', |
46
|
|
|
'profile' => 'DoS\UserBundle\Form\Type\CustomerProfileType', |
47
|
|
|
) |
48
|
|
|
), |
49
|
|
|
'validation_groups' => array( |
50
|
|
|
'default' => array('dos', 'sylius', 'sylius_customer_profile'), |
51
|
|
|
'profile' => array('dos', 'sylius', 'sylius_customer_profile'), |
52
|
|
|
) |
53
|
|
|
), |
54
|
|
|
'user' => array( |
55
|
|
|
'classes' => array( |
56
|
|
|
'model' => 'DoS\UserBundle\Model\User', |
57
|
|
|
'controller' => 'DoS\UserBundle\Controller\UserController', |
58
|
|
|
'repository' => 'DoS\UserBundle\Doctrine\ORM\UserRepository', |
59
|
|
|
'form' => array( |
60
|
|
|
'default' => '\DoS\UserBundle\Form\Type\UserType', |
61
|
|
|
) |
62
|
|
|
), |
63
|
|
|
'validation_groups' => array( |
64
|
|
|
'default' => array('dos', 'sylius'), |
65
|
|
|
'registration' => array('dos', 'dos_registration', 'sylius', 'sylius_user_registration'), |
66
|
|
|
) |
67
|
|
|
), |
68
|
|
|
'user_oauth' => array( |
69
|
|
|
'classes' => array( |
70
|
|
|
'model' => 'DoS\UserBundle\Model\UserOAuth', |
71
|
|
|
), |
72
|
|
|
), |
73
|
|
|
) |
74
|
|
|
)); |
75
|
|
|
} |
76
|
|
|
} |
77
|
|
|
|