-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathservice_container.yaml
417 lines (417 loc) · 24.8 KB
/
service_container.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
questions:
-
uuid: 1eebf878-8b96-6fe4-bbf2-99d84c92580c
question: 'Could a parameter be removed from a Symfony\Component\DependencyInjection\ParameterBag\ContainerBag?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php'
-
uuid: 1eebf878-8b98-60e2-8300-99d84c92580c
question: 'What is the default priority used when adding a new compiler pass?'
answers:
- { value: '0', correct: true }
- { value: '10', correct: false }
- { value: '1000', correct: false }
- { value: '-255', correct: false }
- { value: '100', correct: false }
help: 'https://symfony.com/doc/current/components/dependency_injection/compilation.html#controlling-the-pass-ordering'
-
uuid: 1eebf878-8b98-6344-9f43-99d84c92580c
question: "Let's assume, we have a private service my_private_service. Will this work ? $container->get('my_private_service');"
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://symfony.com/doc/current/service_container/alias_private.html'
-
uuid: 1eebf878-8b98-65d8-89f3-99d84c92580c
question: 'Which of the following sentences are true about synthetic services?'
answers:
- { value: 'Third-party services cannot be registered as synthetic.', correct: false }
- { value: 'The kernel service is synthetic.', correct: true }
- { value: 'They are injected into the container instead of being created by the container.', correct: true }
- { value: 'They cannot be injected into another services.', correct: false }
help: 'https://symfony.com/doc/current/service_container/synthetic_services.html'
-
uuid: 1eebf878-8b98-661e-af6f-99d84c92580c
question: 'Could the number of time each environment variables has been resolved be obtained when using ContainerBuilder?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1485'
-
uuid: 1eebf878-8b98-6786-a236-99d84c92580c
question: 'What is true about ContainerConfigurator?'
answers:
- { value: "it's an internal class that you should not use in your application", correct: false }
- { value: 'it allows to work with service definitions', correct: true }
- { value: "it doesn't exist", correct: false }
- { value: 'it allows to configure a service after its instanciation', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1eebf878-8b98-68b2-8f41-99d84c92580c
question: 'Could an EnvPlaceholderParameterBag be merged into another one?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/DependencyInjection/ParameterBag/EnvPlaceholderParameterBag.php#L103'
-
uuid: 1eebf878-8b98-6ce0-93de-99d84c92580c
question: 'Will Autowiring automatically inject dependencies of an autowired service?'
answers:
- { value: 'Yes, autowiring will find and register all dependencies', correct: false }
- { value: 'Yes, if dependencies are explicitly declared as autowired or manually configured.', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/service_container/autowiring.html'
-
uuid: 1eebf878-8b99-65e6-9c14-99d84c92580c
question: 'Could parameters be cleared from a ContainerParameterBag?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php'
-
uuid: 1eebf878-8b99-6884-ba5f-99d84c92580c
question: 'Which sentences are true about compiler pass registration ?'
answers:
- { value: 'When a compiler pass is registered, you can chose the step where it will be executed. 6 steps are available', correct: false }
- { value: 'When a compiler pass is registered, you can chose the step where it will be executed. 5 steps are available', correct: false }
- { value: 'Compiler pass are automatically registered if they implement CompilerPassInterface and autoconfigure is set to true', correct: true }
- { value: 'Compiler pass can be registered in the build method of the Kernel', correct: true }
- { value: 'When a compiler pass is registered, you can chose the step where it will be executed. 4 steps are available', correct: false }
help: 'https://symfony.com/doc/current/components/dependency_injection/compilation.html'
-
uuid: 1eebf878-8b99-68ca-8cdb-99d84c92580c
question: 'Which of the following statements are true about the so-called compiler passes?'
answers:
- { value: 'They check that all registered services definitions are valid and some required global parameters are not missing.', correct: true }
- { value: 'They prevent the ContainerBuilder object from being compiled if they detect any circular references in services definitions.', correct: true }
- { value: 'They are always triggered on every HTTP requests made to the Symfony application.', correct: false }
- { value: 'They perform some optimization operations on a ContainerBuilder instance in order to generate the most efficient PHP code possible.', correct: true }
- { value: 'They allow to add, alter or remove any services definitions of a ContainerBuilder object.', correct: true }
help: 'https://symfony.com/doc/current/service_container/compiler_passes.html#main'
-
uuid: 1eebf878-8b99-691a-a06d-99d84c92580c
question: 'Which of the followings are not part of the built-in loaders?'
answers:
- { value: JsonLoader, correct: true }
- { value: CsvLoader, correct: true }
- { value: PoFileLoader, correct: false }
- { value: MoFileLoader, correct: false }
- { value: JsonFileLoader, correct: false }
- { value: ArrayLoader, correct: false }
- { value: PhpFileLoader, correct: false }
- { value: CsvFileLoader, correct: false }
- { value: QtFileLoader, correct: false }
help: 'https://github.com/symfony/translation/tree/2.8/Loader'
-
uuid: 1eebf878-8b9a-6266-96a4-99d84c92580c
question: 'Is it possible to create a service that is not publicly accessible?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/service_container/alias_private.html#marking-services-as-public-private'
-
uuid: 1eebf878-8b9a-69be-97e2-99d84c92580c
question: 'Is it possible to use a constant in a parameter?'
answers:
- { value: 'Yes in XML format', correct: true }
- { value: 'No', correct: false }
- { value: 'Yes, in PHP', correct: true }
- { value: 'Yes, in the YAML format (thanks to the expression language component)', correct: true }
help: 'https://symfony.com/doc/current/configuration.html#constants-as-parameters'
-
uuid: 1eebf878-8b9a-6a0e-9c3a-99d84c92580c
question: 'Can you inject a dependency to a service without passing it to the constructor?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/service_container/injection_types.html'
-
uuid: 1eebf878-8b9a-6c0c-89ff-99d84c92580c
question: 'What is a "Service Configurator" in Symfony?'
answers:
- { value: "It's a Symfony built-in service that can be obtained as $container->get('configurator')", correct: false }
- { value: "There's no such a thing in Symfony's Dependency Injection component.", correct: false }
- { value: "It's a feature of the Dependency Injection component that allows to apply some configuration logic to all the services that define a specific tag.", correct: false }
- { value: "It's a PHP callable that you can optionally execute to configure a Symfony service after its instantiation.", correct: true }
help: 'https://symfony.com/doc/current/service_container/configurators.html'
-
uuid: 1eebf878-8b9a-6c5c-ac18-99d84c92580c
question: 'Could a ParameterBag be frozen?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php'
-
uuid: 1eebf878-8b9b-6030-b99f-99d84c92580c
question: 'What is the way to add a loader to the translator?'
answers:
- { value: '$translator->addArrayLoader(new ArrayLoader());', correct: false }
- { value: "$translator->addLoader('array', new ArrayLoader());", correct: true }
- { value: '$translator->addLoader(new ArrayLoader());', correct: false }
- { value: "$translator->addLoader(new ArrayLoader(), 'array');", correct: false }
help: 'https://symfony.com/doc/current/components/translation.html#loading-message-catalogs'
-
uuid: 1eebf878-8b9b-6288-afdc-99d84c92580c
question: 'What is the purpose of the autowire configuration flag in a service definition?'
answers:
- { value: 'It allows to get ride of the a circular reference error for the service.', correct: false }
- { value: "It allows implicit dependencies registration based on the service constructor's typehint.", correct: true }
- { value: 'It allows the service to be automatically called on some kernel events.', correct: false }
help: 'https://symfony.com/doc/current/components/dependency_injection/autowiring.html'
-
uuid: 1eebf878-8b9c-61b0-ab03-99d84c92580c
question: 'Could new parameters be added into a Symfony\Component\DependencyInjection\ParameterBag\ContainerBag?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/DependencyInjection/ParameterBag/ContainerBag.php'
-
uuid: 1eebf878-8b9c-6516-83f6-99d84c92580c
question: 'Does service ids considered as case-sensitive?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/symfony/blob/2.0/src/Symfony/Component/DependencyInjection/Container.php#L221'
-
uuid: 1eebf878-8b9d-6330-b506-99d84c92580c
question: 'Could service configurators use __invoke() to configure a service?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/service_container/configurators.html#using-the-configurator'
-
uuid: 1eebf878-8b9d-6826-a51d-99d84c92580c
question: 'Could a parameter be removed from a FrozenParameterBag?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://github.com/symfony/symfony/blob/2.3/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php'
-
uuid: 1eebf878-8b9d-68bc-8b85-99d84c92580c
question: 'Could imports be configured using ContainerConfigurator?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/dependency-injection/blob/8126f0be4ff984e4db0140e60917900a53facb49/Loader/Configurator/ContainerConfigurator.php#L68'
-
uuid: 1eebf878-8b9f-62de-9af3-99d84c92580c
question: 'Which types of injection are available in the component?'
answers:
- { value: constructor, correct: true }
- { value: property, correct: true }
- { value: setter, correct: true }
- { value: immutable-property, correct: false }
- { value: immutable-setter, correct: true }
- { value: constant, correct: false }
- { value: getter, correct: false }
help: 'https://symfony.com/doc/current/service_container/injection_types.html'
-
uuid: 1eebf878-8b9f-636a-8ea3-99d84c92580c
question: 'When implementing Command pattern, the use of Service Subscriber is another lazy loading implementation. Which of the following statement is true ?'
answers:
- { value: 'Your implementation must implement ServiceSubscriberInterface', correct: true }
- { value: 'Static method getSubscribedServices shall be implemented and listed services can be indexed with your own keys', correct: true }
- { value: 'Static method getSubscribedServices shall be implemented and listed services canot be indexed with your own keys', correct: false }
- { value: 'ContainerInterface must be injected in your implementation', correct: true }
- { value: 'Service locator is a subset of service container', correct: true }
help: 'https://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-subscriber'
-
uuid: 1eebf878-8b9f-63ba-b1d8-99d84c92580c
question: 'Which of the following statements are true about autowiring ?'
answers:
- { value: 'Symfony basic configuration comes with autowire set to true', correct: true }
- { value: 'Type-hinting is used to map the correct services from the service container, using type-hinting as service id', correct: true }
- { value: 'Autowiring can be used in the __construct() method as well as in all other methods of the service', correct: true }
- { value: 'Autowiring can only be used in the __construct() method of the service', correct: false }
help: 'https://symfony.com/doc/current/service_container/autowiring.html'
-
uuid: 1eebf878-8b9f-6400-9572-99d84c92580c
question: 'Which of the following factory design pattern are available for service container defintion ?'
answers:
- { value: 'Static factories', correct: true }
- { value: 'Non-Static factories', correct: true }
- { value: 'Dynamic factories', correct: false }
- { value: 'Invokable factories', correct: true }
- { value: 'Clonable factories', correct: false }
help: 'https://symfony.com/doc/current/service_container/factories.html'
-
uuid: 1eebf878-8b9f-648c-b082-99d84c92580c
question: 'Using Dependency Injection, what is the correct way to override a service class using ContainerBuilder class?'
answers:
- { value: "$container->getDefinition('my.service')->setClass('My\\Service\\Class')", correct: true }
- { value: "$container->getService('my.service')->setDefinition('My\\Service\\Class')", correct: false }
- { value: "$container->getDefinition('my.service')->setService('My\\Service\\Class')", correct: false }
- { value: "$container->getService('my.service')->setClass('My\\Service\\Class')", correct: false }
help: 'https://symfony.com/doc/current/service_container/definitions.html'
-
uuid: 1eebf878-8b9f-65f4-aca1-99d84c92580c
question: 'Can configuration parameters in Symfony contain array values, such as in the parameters section of config/services.yaml?'
answers:
- { value: 'true', correct: true }
- { value: 'false', correct: false }
help: 'https://symfony.com/doc/current/configuration.html#configuration-parameters'
-
uuid: 1eebf878-8b9f-670c-beb7-99d84c92580c
question: "With default configuration each time you retrieve the service, you'll get the same instance ?"
answers:
- { value: 'true', correct: true }
- { value: 'false', correct: false }
help: 'https://symfony.com/doc/current/service_container.html#creating-configuring-services-in-the-container'
-
uuid: 1eebf878-8b9f-6752-a151-99d84c92580c
question: 'What is the correct load() method definition in Symfony\Component\DependencyInjection\Extension\ExtensionInterface?'
answers:
- { value: 'public function load(array $configs, ContainerBuilder $container)', correct: true }
- { value: 'public function load(ContainerBuilder $container, array $configs)', correct: false }
help: 'https://symfony.com/doc/current/components/dependency_injection/compilation.html#managing-configuration-with-extensions'
-
uuid: 1eebf878-8b9f-67a2-ab9f-99d84c92580c
question: 'Service parameters can be set at runtime'
answers:
- { value: 'true', correct: false }
- { value: 'false', correct: true }
help: 'https://symfony.com/doc/current/service_container.html#service-parameters'
-
uuid: 1eebf878-8ba1-6d72-b87d-99d84c92580c
question: "Which injection types are supported by the Symfony's DIC?"
answers:
- { value: setter, correct: true }
- { value: constructor, correct: true }
- { value: property, correct: true }
- { value: getter, correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1eebf878-8ba1-6fb6-af5f-99d84c92580c
question: 'What is the correct option to add other directories in the translator configuration?'
answers:
- { value: "framework:translator:paths:- %kernel.project_dir%/translations'", correct: true }
- { value: "framework:translator:add_paths:- %kernel.project_dir%/translations'", correct: false }
- { value: "framework:translator:custom_directories:- %kernel.project_dir%/translations'", correct: false }
- { value: "framework:translator:directories:- %kernel.project_dir%/translations'", correct: false }
- { value: "framework:translator:custom_paths:- %kernel.project_dir%/translations'", correct: false }
help: 'https://symfony.com/doc/current/reference/configuration/framework.html#reference-translator-paths'
-
uuid: 1eebf878-8ba2-6056-a6e9-99d84c92580c
question: 'When creating a service definition using PHP, could the visibility of the service be changed using Symfony\Component\DependencyInjection\Definition::setPublic($boolean) ?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://github.com/symfony/symfony/blob/c8418254edd0851181da5384bc2f94434ca0570d/src/Symfony/Component/DependencyInjection/Definition.php#L541'
-
uuid: 1ef5c09c-d7c9-6560-8979-85f7277877d1
question: 'What is a Symfony Service Container?'
answers:
- { value: 'A database management tool', correct: false }
- { value: 'A special object where services are stored', correct: true }
- { value: 'A logging system', correct: false }
- { value: 'A caching mechanism', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c09e-fdaa-6034-8508-a35d6de03e76
question: 'What is Dependency Injection (DI) in Symfony?'
answers:
- { value: 'A way to manually inject code into templates', correct: false }
- { value: 'A method to provide necessary objects to a class from external sources', correct: true }
- { value: 'A technique for optimizing database queries', correct: false }
- { value: 'A way to encrypt user data', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0a1-66d6-6f60-9521-f194ab73eb2f
question: 'How can you load all classes as services automatically inside a specific folder in Symfony?'
answers:
- { value: 'By using the autowire: false configuration', correct: false }
- { value: 'By adding all class names manually in services.yaml', correct: false }
- { value: 'By setting autowire: true and defining a resource', correct: true }
- { value: 'By using the configurator tag', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0ac-c210-6358-aea3-8f65d65ecf88
question: 'How can you make a service available only in the "dev" environment?'
answers:
- { value: 'By using the autowire: false option.', correct: false }
- { value: "By adding the #[When(env: 'dev')] attribute to the service class.", correct: true }
- { value: 'By defining it in the services_test.yaml file.', correct: false }
- { value: 'By setting the service as public.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html#limiting-services-to-a-specific-symfony-environment'
-
uuid: 1ef5c0af-d817-65b8-8456-919dad88c362
question: 'Which of the following is NOT a benefit of using the service container?'
answers:
- { value: 'Centralizing object construction.', correct: false }
- { value: 'Improving application performance.', correct: false }
- { value: 'Allowing services to be shared and reused.', correct: false }
- { value: 'Making all services public by default.', correct: true }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0b2-fda9-6a80-9f5e-cd37e2e3aa3d
question: "In the default services.yaml configuration, what does the resource: '../src/' option do?"
answers:
- { value: 'It excludes the src/ directory from being used as services.', correct: false }
- { value: 'It imports all classes in the src/ directory as services.', correct: true }
- { value: 'It prevents autowiring for all services.', correct: false }
- { value: 'It makes the classes in the src/Entity directory available as services.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0b9-c808-679e-a4ff-cd4d8904a960
question: 'What happens if a service is defined as public: false in Symfony?'
answers:
- { value: 'It cannot be injected into other services.', correct: false }
- { value: 'It can only be accessed within the class where it is defined.', correct: false }
- { value: 'It cannot be accessed directly from the service container.', correct: true }
- { value: 'It is automatically excluded from autowiring.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0bd-3df5-61ca-b4e6-b73eeabedf7c
question: 'What does the lazy option in a service definition do?'
answers:
- { value: 'It defers the instantiation of the service until it is actually needed.', correct: true }
- { value: 'It prevents the service from being injected into other services.', correct: false }
- { value: 'It makes the service available only in the "prod" environment.', correct: false }
help: 'https://symfony.com/doc/current/service_container/lazy_services.html'
-
uuid: 1ef5c0c1-1ac7-64a6-9cbf-45ad2711c61f
question: 'When would you use the private visibility for a service?'
answers:
- { value: 'When you want the service to be accessible from anywhere in the application.', correct: false }
- { value: 'When the service should be used only internally within other services.', correct: true }
- { value: 'When the service should not be instantiated at all.', correct: false }
- { value: 'When the service is no longer needed in the application.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0c3-627f-6c92-8785-2179a55e4fcd
question: 'What is a service alias in Symfony used for?'
answers:
- { value: 'To create a duplicate service with the same functionality.', correct: false }
- { value: 'To define an alternative name for an existing service.', correct: true }
- { value: 'To make a service public.', correct: false }
- { value: 'To remove a service from the service container.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0c5-7d09-6688-87f2-a3540221237e
question: "Which command is used to view a specific service's configuration and dependencies in Symfony?"
answers:
- { value: 'php bin/console service:show [service_name]', correct: false }
- { value: 'php bin/console debug:container [service_name]', correct: true }
- { value: 'php bin/console container:inspect [service_name]', correct: false }
- { value: 'php bin/console debug:services [service_name]', correct: false }
help: 'https://symfony.com/doc/current/service_container.html'
-
uuid: 1ef5c0ce-a7eb-6956-9bc8-1baf552f428a
question: 'What is a key benefit of the service in Symfony?'
answers:
- { value: 'It is automatically created every time it is requested.', correct: false }
- { value: 'It creates a new instance each time it is called.', correct: false }
- { value: 'The same instance is returned each time it is requested.', correct: true }
- { value: 'It is automatically destroyed after each use.', correct: false }
help: 'https://symfony.com/doc/current/service_container.html#creating-configuring-services-in-the-container'
-
uuid: 1ef5c0dc-17f6-6b76-9bb6-93e4d8e83be3
question: 'In YAML configuration, which keyword is used to define explicit arguments for a service?'
answers:
- { value: parameters, correct: false }
- { value: options, correct: false }
- { value: values, correct: false }
- { value: arguments, correct: true }
help: 'https://symfony.com/doc/current/service_container.html#manually-wiring-arguments'