New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Adobe AD0-E716 Exam - Topic 12 Question 52 Discussion

Actual exam question for Adobe's AD0-E716 exam
Question #: 52
Topic #: 12
[All AD0-E716 Questions]

An Adobe Commerce developer is tasked to add a file field to a custom form in the administration panel, the field must accept only .PDF files with size less or equal than 2 MB. So far the developer has added the following code within the form component xml file, inside the fieldset node:

How would the developer implement the validations?

A)

Add the Validations Within the HyVendor\MyModule\Controller\Adminhtml\CustomEntity\UploadPdf Controller

B)

Add a virtual type forMyvendor\MyModuie\Modei\customPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi:

C)

Add the following code inside the node:

Show Suggested Answer Hide Answer
Suggested Answer: B

The developer can add a virtual type for MyvendorMyModuieModeicustomPdfupioader specifying the aiiowedExtensions and the maxFiiesize for the constructor, within the module's di.xmi. This way, the developer can reuse the existing file uploader class and customize it for the specific field without modifying the core code. Verified Reference: [Magento 2.4 DevDocs] [Magento Stack Exchange]


Contribute your Thoughts:

0/2000 characters
Harrison
7 days ago
I feel like Option A is more straightforward for this task.
upvoted 0 times
...
Paola
12 days ago
Option C seems too vague. Not sure it covers all validations.
upvoted 0 times
...
Christoper
17 days ago
I prefer Option B. It sets the rules in the constructor, which is cleaner.
upvoted 0 times
...
Caprice
22 days ago
A is a solid choice, but might need more handling.
upvoted 0 times
...
Leatha
27 days ago
B is definitely the way to go, it covers all bases.
upvoted 0 times
...
Ulysses
1 month ago
Haha, I bet the developer who came up with Option C is the same one who uses "magic numbers" in their code.
upvoted 0 times
...
Willow
1 month ago
Option A is a no-go, you don't want to put validation logic in the controller. That's a big no-no!
upvoted 0 times
...
Fredric
1 month ago
Option C looks like a quick fix, but it's not the best practice. Validation should be handled in the controller or a dedicated service.
upvoted 0 times
...
Jenise
2 months ago
I agree, Option B is the best approach. Encapsulating the validation logic in a custom uploader class is the way to go.
upvoted 0 times
...
Gilbert
2 months ago
Option B is the way to go, it's the most elegant and maintainable solution.
upvoted 0 times
...
Ling
2 months ago
I feel like we discussed the importance of using the dependency injection pattern, which makes me lean towards option B for its constructor approach.
upvoted 0 times
...
Levi
2 months ago
I disagree, A could work too if implemented correctly.
upvoted 0 times
...
Ceola
2 months ago
Option B seems like the best choice for validation.
upvoted 0 times
...
An
2 months ago
I’m a bit confused about option C. It mentions adding code inside the node, but I can't recall if that’s the correct place for file validations.
upvoted 0 times
...
Lino
3 months ago
I think Option A is the best choice. It directly handles the upload logic.
upvoted 0 times
...
Luisa
3 months ago
Surprised that C is even an option, seems too simple!
upvoted 0 times
...
Isabella
3 months ago
I remember something about virtual types from our practice questions, so option B could be a good way to set the allowed extensions and file size.
upvoted 0 times
...
Ronna
3 months ago
I think option A might be the right choice since it involves handling the upload directly in the controller, but I'm not entirely sure if that's the best practice for validations.
upvoted 0 times
...
William
4 months ago
I'm leaning towards Option B as well. Putting the validation in the DI configuration keeps the form component clean and reusable. Plus, it allows you to easily change the validation rules in one place if needed.
upvoted 0 times
...
Jerry
4 months ago
Option B seems like the way to go. Encapsulating the validation logic in a custom uploader class and configuring it in the DI makes the most sense to me. That way the form component can just use the uploader without having to worry about the validation details.
upvoted 0 times
...
Mattie
4 months ago
I'm a bit confused by the different options. Option A seems to put the validation logic in the controller, which doesn't seem quite right for a form field. Option C looks interesting, but I'm not sure if that's the best place to handle the validation.
upvoted 0 times
...
Luis
4 months ago
I think Option B looks the most straightforward. Adding a virtual type to specify the allowed extensions and max file size seems like a clean way to handle the validation.
upvoted 0 times
Lonny
1 day ago
I agree, Option B is clear and concise.
upvoted 0 times
...
...

Save Cancel