-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservices.yaml
218 lines (175 loc) · 8.89 KB
/
services.yaml
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
app_website_name: '%env(WEBSITE_NAME)%'
app_swift_mailer_sender_email: '%env(MAILER_SENDER_EMAIL)%' # admin email
app_swift_mailer_sender_name: '%env(MAILER_SENDER_NAME)%' # admin email name
# Custom configuration yaml files paths retrieved with parameter bag:
app_data_fixtures_yaml_dir: '%kernel.project_dir%/src/Utils/Database/DataFixtures/yaml/' # Fixtures used in production
app_template_list_yaml_dir: '%kernel.project_dir%/src/Service/Templating/yaml/'
# PHP paths retrieved with parameter bag:
app_images_upload_directory: '%kernel.project_dir%/public/assets/images/uploads'
app_avatar_image_upload_directory: '%app_images_upload_directory%/avatars'
app_trick_image_upload_directory: '%app_images_upload_directory%/tricks'
# Twig paths:
app_twig_assets_directory: 'assets'
app_twig_image_directory: '%app_twig_assets_directory%/images/'
app_twig_image_upload_directory: '%app_twig_image_directory%uploads/'
app_twig_avatar_upload_directory: '%app_twig_image_upload_directory%avatars/'
app_twig_trick_upload_directory: '%app_twig_image_upload_directory%tricks/'
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# setup special, global autowiring rules
bind:
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{DependencyInjection,Domain/Entity,Kernel.php,Tests,Utils/Command,Utils/Traits,Utils/Database/Migrations}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
# add a simple PSR3 logger as a service
App\Action\:
resource: '../src/Action'
tags: ['controller.service_arguments']
arguments:
$logger: '@Symfony\Component\HttpKernel\Log\Logger'
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
# add form handler when showing a trick
App\Action\SingleTrickAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\CreateCommentHandler'
# add form handler when creating a new trick comment
App\Action\Admin\CreateCommentAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\CreateCommentHandler'
# add form handler when creating a new trick
App\Action\Admin\CreateTrickAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\CreateTrickHandler'
# add comment deletion without form and form handler
App\Action\Admin\AjaxDeleteCommentAction:
tags: ['controller.service_arguments']
# add media deletion without form and form handler
App\Action\Admin\AjaxDeleteMediaAction:
tags: ['controller.service_arguments']
# add trick deletion without form and form handler
App\Action\Admin\AjaxDeleteTrickAction:
tags: ['controller.service_arguments']
# add user (account) deletion without form and form handler
App\Action\Admin\AjaxDeleteUserAction:
tags: ['controller.service_arguments']
# add form handler when calling login
App\Action\Admin\LoginAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\LoginHandler'
# add form handler when renewing password
App\Action\Admin\RenewPasswordAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\RenewPasswordHandler'
# add form handler when requesting new password
App\Action\Admin\RequestNewPasswordAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\RequestNewPasswordHandler'
# add form handler when creating a new user account
App\Action\Admin\RegisterAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\RegisterHandler'
# add form handler when updating a user avatar or account (profile)
App\Action\Admin\UpdateProfileAction:
tags: ['controller.service_arguments']
arguments:
$formHandlers: ['@App\Service\Form\Handler\UpdateProfileAvatarHandler', '@App\Service\Form\Handler\UpdateProfileInfosHandler']
# add form handler when updating a trick
App\Action\Admin\UpdateTrickAction:
tags: ['controller.service_arguments']
arguments:
$formHandler: '@App\Service\Form\Handler\UpdateTrickHandler'
# add custom unchanged (not updated) trick listener
App\Service\Event\Listener\UnchangedTrickListener:
tags:
- { name: kernel.event_listener, event: form.unchanged }
# add custom form subscriber
App\Service\Event\Subscriber\FormSubscriber:
# add custom DTO mapper
App\Service\Form\DataMapper\DTOMapper:
# add login handler
App\Service\Form\Handler\LoginHandler:
# add comment creation handler
App\Service\Form\Handler\CreateCommentHandler:
# add trick creation handler
App\Service\Form\Handler\CreateTrickHandler:
# add register handler
App\Service\Form\Handler\RegisterHandler:
# add renew password handler
App\Service\Form\Handler\RenewPasswordHandler:
arguments:
$emailConfigFactory: '@App\Service\Mailer\Email\EmailConfigFactory'
# add request new password handler
App\Service\Form\Handler\RequestNewPasswordHandler:
arguments:
$emailConfigFactory: '@App\Service\Mailer\Email\EmailConfigFactory'
# add update profile avatar handler
App\Service\Form\Handler\UpdateProfileAvatarHandler:
# add update profile infos handler
App\Service\Form\Handler\UpdateProfileInfosHandler:
# add (trick) image to crop creation/update type
App\Service\Form\TypeToEmbed\ImageToCropType:
arguments:
$dataMapper: '@App\Service\Form\DataMapper\DTOMapper'
# add (trick) video infos creation/update type
App\Service\Form\TypeToEmbed\VideoInfosType:
arguments:
$dataMapper: '@App\Service\Form\DataMapper\DTOMapper'
# add user update profile avatar type
App\Service\Form\Type\Admin\UpdateProfileAvatarType:
arguments:
$formSubscriber: '@App\Service\Event\Subscriber\FormSubscriber'
# add user update profile infos type
App\Service\Form\Type\Admin\UpdateProfileInfosType:
arguments:
$formSubscriber: '@App\Service\Event\Subscriber\FormSubscriber'
# add trick update type
App\Service\Form\Type\Admin\UpdateTrickType:
arguments:
$formSubscriber: '@App\Service\Event\Subscriber\FormSubscriber'
# add EmailConfigFactory
App\Service\Mailer\Email\EmailConfigFactoryInterface: '@App\Service\Mailer\Email\EmailConfigFactory'
# add Twig custom template renderer
App\Service\Templating\TemplateRendererInterface: '@App\Service\Templating\TwigTemplateRenderer'
App\Service\Templating\TemplateBlockRendererInterface: '@App\Service\Templating\TwigTemplateRenderer'
# add unused images deletion command which can be combined with cron job
App\Utils\Command\DeleteUnusedImageCommand:
public: false
tags: ['console.command']
# add "preg_replace" function
App\Utils\Templating\StringReplaceTwigExtension:
public: false
tags: ['twig.extension']
# add "uuid_encode" filter
App\Utils\Templating\UuidTwigExtension:
public: false
tags: ['twig.extension']
# add ResultSetMappingBuilder as a service for native queries
Doctrine\ORM\Query\ResultSetMappingBuilder:
# add PSR3 logger as default logger for actions (controllers)
Symfony\Component\HttpKernel\Log\Logger:
arguments: ['critical','%kernel.project_dir%/var/log/dev.log']
# add options resolver
Symfony\Component\OptionsResolver\OptionsResolver: