-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdata_transformers.yaml
62 lines (62 loc) · 3.52 KB
/
data_transformers.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
questions:
-
uuid: 1eebf878-8b9a-6838-a655-99d84c92580c
question: 'Does a Symfony\Component\Form\Exception\TransformationFailedException thrown in a DataTransformer cause a validation error ?'
answers:
- { value: 'Yes', correct: true }
- { value: 'No', correct: false }
help: 'https://symfony.com/doc/current/form/data_transformers.html'
-
uuid: 1eebf878-8b9c-6aa2-a4b0-99d84c92580c
question: 'How to add a DataTransformer to the tags field?'
answers:
- { value: "$builder->add('tags', TextType::class)->addModelTransformer(...);", correct: false }
- { value: "$builder->add($builder->create('tags',TextType::class)->addModelTransformer(...));", correct: true }
- { value: "$builder->add('tags', TextType::class); $builder->get('tags')->addModelTransformer(...);", correct: true }
help: 'https://symfony.com/doc/current/form/data_transformers.html#simple-example-transforming-string-tags-from-user-input-to-an-array'
-
uuid: 1eebf878-8ba0-6116-964a-99d84c92580c
question: 'How to Use Data Transformers ?'
answers:
- { value: "$builder->get('tags')->addModelTransformer(...);", correct: true }
- { value: "$builder->add($builder->create('tags', TextType::class)->addModelTransformer(...));", correct: true }
- { value: "$builder->add('tags', TextType::class)->addModelTransformer(...);", correct: false }
help: 'https://symfony.com/doc/current/form/data_transformers.html'
-
uuid: 1eebf878-8ba4-6946-9ff1-99d84c92580c
question: 'Are data transformers applied to a form field that has the inherit_data option set?'
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://symfony.com/doc/current/form/data_transformers.html'
-
uuid: 1eebf878-8ba5-6382-a6c5-99d84c92580c
question: "Is this a valid way to add a DataTransformer ? $builder->add('issue', TextType::class)->addModelTransformer($transformer);"
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://symfony.com/doc/current/form/data_transformers.html#using-the-transformer'
-
uuid: 1eebf878-8ba5-63c8-9923-99d84c92580c
question: 'In the CallbackTransformer, the first function is used to transform the data and the second function is used to reverse-transform it. Is that right ?'
answers:
- { value: 'No', correct: false }
- { value: 'Yes', correct: true }
help: 'https://github.com/symfony/symfony/blob/7.0/src/Symfony/Component/Form/CallbackTransformer.php'
-
uuid: 1eebf878-8ba5-6418-8750-99d84c92580c
question: 'What Exception is thrown when data is not valid in the DataTransformer ?'
answers:
- { value: FailedTransformationException, correct: false }
- { value: DataTransformationException, correct: false }
- { value: ValidTransformationException, correct: false }
- { value: TransformationFailedException, correct: true }
help: 'https://symfony.com/doc/current/form/data_transformers.html#creating-the-transformer'
-
uuid: 1eebf878-8ba5-645e-bb9b-99d84c92580c
question: 'In Data Transformer, in the reverseTransform, how to customize the error message ?'
answers:
- { value: 'By setting the setInvalidMessage on the TransformationFailedException', correct: true }
- { value: 'By setting the invalid_message in the options of the form type', correct: true }
- { value: "It's not possible", correct: false }
help: 'https://symfony.com/doc/current/form/data_transformers.html#using-the-transformer'