-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathservice_decoration.yaml
132 lines (132 loc) · 8.4 KB
/
service_decoration.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
questions:
-
uuid: 1eebf878-8b98-654c-b75e-99d84c92580c
question: 'Could the priority of a decorating service be defined?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#decoration-priority'
-
uuid: 1eebf878-8b9f-682e-a048-99d84c92580c
question: 'Decorating services can be done in YAML using the decorates key. This prevent original service override and autowire decorated class name with decorator instance'
answers:
- { value: 'true', correct: true }
- { value: 'false', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef568f6-2e61-648a-a7b3-bff7ab4fac88
question: 'What happens to the original service when you override an existing service definition in Symfony?'
answers:
- { value: 'The original service is preserved', correct: false }
- { value: 'The original service is replaced, and the old definition is lost', correct: true }
- { value: 'The original service and the new one are both available', correct: false }
- { value: 'The original service is automatically decorated', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef568fb-d9d6-6d56-863d-af80c905008d
question: 'How do you keep a reference to the original service when decorating it in Symfony?'
answers:
- { value: 'By using the #[old] service reference', correct: false }
- { value: 'By using the #[AutowireOriginal] attribute', correct: false }
- { value: 'By using the #[AsDecorator] attribute and referencing .inner', correct: true }
- { value: 'By registering both services under different IDs', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef568ff-80aa-66fc-b706-d3849883f55e
question: 'What does the decoration_inner_name option in the service configuration do?'
answers:
- { value: 'It changes the ID of the decorated service', correct: true }
- { value: 'It changes the class name of the decorated service', correct: false }
- { value: 'It controls the visibility of the decorated service', correct: false }
- { value: 'It sets the priority of the decorator', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef56904-2bbf-6f3e-bc96-e1f0ed89f6a3
question: "If a service decorator's constructor has multiple arguments of the same decorated service type, what must be done?"
answers:
- { value: 'Use #[AutowireDecorated] to inject the decorated service explicitly', correct: true }
- { value: 'Use autowiring to resolve the conflict', correct: false }
- { value: 'Manually alias the services', correct: false }
- { value: 'You cannot have multiple arguments of the same type', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef56907-dfc3-650a-b410-edad3cc3398c
question: 'How does Symfony determine the priority of multiple decorators applied to the same service?'
answers:
- { value: 'Alphabetically by class name', correct: false }
- { value: 'Based on the order in which they are defined', correct: false }
- { value: 'Using the decoration_priority option', correct: true }
- { value: 'Randomly during service compilation', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef5690b-31ac-66ac-b4a7-cf93cad5721a
question: 'What will happen if a decorator is configured to decorate a non-existent service and the onInvalid option is set to ignore?'
answers:
- { value: 'A ServiceNotFoundException will be thrown', correct: false }
- { value: 'The container will remove the decorator', correct: true }
- { value: 'The container will set the decorated service to null', correct: false }
- { value: 'The container will automatically create the missing service', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'
-
uuid: 1ef5b0aa-c1e6-64b6-8cbd-c1c5aeabf7a9
question: 'How does Symfony determine the priority of multiple decorators applied to the same service?'
answers:
- { value: 'Alphabetically by class name', correct: false }
- { value: 'Based on the order in which they are defined', correct: false }
- { value: 'Using the decoration_priority option', correct: true }
- { value: 'Randomly during service compilation', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#decoration-priority'
-
uuid: 1ef5b0ae-d16e-6fa6-899f-bd172ab2335d
question: 'What will happen if a decorator is configured to decorate a non-existent service and the onInvalid option is set to ignore?'
answers:
- { value: 'A ServiceNotFoundException will be thrown', correct: false }
- { value: 'The container will remove the decorator', correct: true }
- { value: 'The container will set the decorated service to null', correct: false }
- { value: 'The container will automatically create the missing service', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#control-the-behavior-when-the-decorated-service-does-not-exist'
-
uuid: 1ef5b0b6-5c02-622e-a929-910a987c2424
question: 'Which of the following is a valid way to create a stack of decorators in Symfony?'
answers:
- { value: 'Using the priority option in services.yaml', correct: false }
- { value: 'Declaring multiple decorators in a stack configuration', correct: true }
- { value: 'Using the decorators_chain tag', correct: false }
- { value: 'Registering each decorator in separate services.yaml files', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#stacking-decorators'
-
uuid: 1ef5b0b9-a1c3-62ba-bb58-f1271e433949
question: 'In a decorator stack, how can you refer to a specific frame within the stack?'
answers:
- { value: 'By using the service ID with a .frame_key suffix', correct: true }
- { value: 'By creating an alias for each frame', correct: false }
- { value: 'By using @frame_reference in the configuration', correct: false }
- { value: "By specifying the frame's class name", correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#stacking-decorators'
-
uuid: 1ef5b0bd-2d68-6600-b031-0915745f7de9
question: "When using the onInvalid option set to null, what change might be necessary in the decorator's constructor?"
answers:
- { value: 'The decorated service parameter must be made nullable', correct: true }
- { value: 'The decorated service must be explicitly instantiated', correct: false }
- { value: 'The constructor must be removed', correct: false }
- { value: 'No changes are needed', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#control-the-behavior-when-the-decorated-service-does-not-exist'
-
uuid: 1ef5b0c0-600f-6a60-a4ff-09f0c30bd181
question: 'Why should a compiler pass that creates service definitions dynamically be registered with PassConfig::TYPE_BEFORE_OPTIMIZATION ?'
answers:
- { value: 'To ensure the service is available during the decoration pass', correct: true }
- { value: 'To prevent Symfony from optimizing away unused services', correct: false }
- { value: 'To automatically apply the decoration_priority', correct: false }
- { value: 'To enable autowiring for dynamically created services', correct: false }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html#control-the-behavior-when-the-decorated-service-does-not-exist'
-
uuid: 1ef5b0c4-d00b-65a4-a273-07d6c1120e43
question: 'When using a service decorator, what keyword is used to reference the original service within the decorator?'
answers:
- { value: original_service, correct: false }
- { value: old_service, correct: false }
- { value: base_service, correct: false }
- { value: inner, correct: true }
help: 'https://symfony.com/doc/current/service_container/service_decoration.html'