Deal of The Day! 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

Posted by Virgie on Oct 31, 2025 at 11:22 AM

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:

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]


Get Premium AD0-E716 Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
27 comments · newest first
HA
Harrison 9 months ago
I feel like Option A is more straightforward for this task.
PA
Paola 9 months ago
Option C seems too vague. Not sure it covers all validations.
CH
Christoper 9 months ago
I prefer Option B. It sets the rules in the constructor, which is cleaner.
CA
Caprice 9 months ago
A is a solid choice, but might need more handling.
LE
Leatha 9 months ago
B is definitely the way to go, it covers all bases.
UL
Ulysses 10 months ago
Haha, I bet the developer who came up with Option C is the same one who uses "magic numbers" in their code.
WI
Willow 10 months ago
Option A is a no-go, you don't want to put validation logic in the controller. That's a big no-no!
FR
Fredric 10 months 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.
JE
Jenise 10 months ago
I agree, Option B is the best approach. Encapsulating the validation logic in a custom uploader class is the way to go.
GI
Gilbert 10 months ago
Option B is the way to go, it's the most elegant and maintainable solution.
LI
Ling 10 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.
LE
Levi 11 months ago
I disagree, A could work too if implemented correctly.
CE
Ceola 11 months ago
Option B seems like the best choice for validation.
AN
An 11 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.
LI
Lino 11 months ago
I think Option A is the best choice. It directly handles the upload logic.
LU
Luisa 11 months ago
Surprised that C is even an option, seems too simple!
IS
Isabella 12 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.
RO
Ronna 12 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.
WI
William 1 year 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.
JE
Jerry 1 year 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.
MA
Mattie 1 year 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.
LU
Luis 1 year 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.
BR
Brock 7 months ago
↳ replying to Luis
Definitely, makes future updates easier!
DO
Donte 8 months ago
↳ replying to Luis
I like how B separates concerns.
HO
Hortencia 8 months ago
↳ replying to Luis
Option A could work too, but B feels cleaner.
ED
Edmond 8 months ago
↳ replying to Luis
Yeah, it keeps the logic organized.
LO
Lonny 9 months ago
↳ replying to Luis
I agree, Option B is clear and concise.
0/2000 characters

Save Cancel