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-E704 Exam - Topic 11 Question 52 Discussion

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

Suppose there are 3 classes: Class A, B and C. Class C have dependecy of Class A You need to overrride/change an argument of class A, create an object of it and inject in Class B in such a way that it should not affect the class C. What should be the magento standard way to do this:

Show Suggested Answer Hide Answer
Suggested Answer: B, C

Contribute your Thoughts:

0/2000 characters
Dorathy
3 months ago
A is the standard approach, no doubt about it.
upvoted 0 times
...
Colene
3 months ago
Surprised to see D even mentioned, that's not standard practice!
upvoted 0 times
...
Craig
3 months ago
C? Really? That doesn't sound right at all.
upvoted 0 times
...
Dante
4 months ago
I think B is better, config.xml is more flexible.
upvoted 0 times
...
Mariann
4 months ago
Option A is definitely the right way to go!
upvoted 0 times
...
Odette
4 months ago
I feel like menu.xml is definitely not the right choice here, but I can't recall the exact reason why.
upvoted 0 times
...
Lynsey
4 months ago
I'm a bit confused about the different XML files. Is system.xml ever used for dependency injection?
upvoted 0 times
...
Luisa
4 months ago
I remember practicing a similar question where we had to override a class, and I think it was definitely in di.xml, not config.xml.
upvoted 0 times
...
Timmy
5 months ago
I think we need to use di.xml for dependency injection, but I'm not entirely sure about the specifics of virtual types.
upvoted 0 times
...
Renato
5 months ago
This seems straightforward enough. I'll just need to review the Magento documentation on dependency injection and make sure I understand how to properly use the virtualType and type nodes to achieve the desired result. I'm confident I can handle this.
upvoted 0 times
...
Chan
5 months ago
Okay, I think I've got this. The standard way is to use the di.xml file to define the virtualType node, override the argument, and then inject the subclass into Class B. That way, Class C remains unaffected. I'll make sure to implement this carefully.
upvoted 0 times
...
Bettye
5 months ago
Hmm, I'm a bit confused on the specifics here. I know we need to use a virtualType node, but I'm not sure if that goes in the di.xml, config.xml, or somewhere else. I'll have to double-check the Magento best practices.
upvoted 0 times
...
Dewitt
5 months ago
This looks like a tricky one. I'll need to carefully review the Magento dependency injection documentation to make sure I understand the proper way to override an argument and inject it into another class without affecting a third class.
upvoted 0 times
...
Boris
10 months ago
Haha, Marvel's right. Using the wrong file would be like trying to bake a cake in the dishwasher. A is the clear winner here.
upvoted 0 times
Alida
8 months ago
Exactly, we don't want any unexpected consequences by using the wrong file.
upvoted 0 times
...
Fatima
8 months ago
Yeah, that's the correct way to do it. It ensures that Class C is not affected.
upvoted 0 times
...
Alpha
9 months ago
A) In module's etc/di.xml, define virtualType node to override argument and create a subclass of A. Then use type node to pass the subclass A object into class B.
upvoted 0 times
...
...
Marvel
10 months ago
A is definitely the way to go. I can't believe anyone would think to use config.xml, system.xml, or menu.xml for this. That would be like trying to change your oil in the microwave.
upvoted 0 times
Cammy
8 months ago
A) In module's etc/di.xml, define virtualType node to override argument and create a subclass of A. Then use type node to pass the subclass A object into class B.
upvoted 0 times
...
Rebecka
8 months ago
Yeah, using di.xml is the standard way to override arguments and inject objects. It keeps things clean and organized.
upvoted 0 times
...
Carla
9 months ago
A) In module's etc/di.xml, define virtualType node to override argument and create a subclass of A. Then use type node to pass the subclass A object into class B.
upvoted 0 times
...
...
Tamra
10 months ago
I agree with Joesph. The Magento standard way is to use di.xml to define the virtual type and then pass the subclass of A into class B.
upvoted 0 times
Sharmaine
8 months ago
Yes, that's the Magento standard way to handle the dependency without affecting Class C.
upvoted 0 times
...
Chantell
9 months ago
I think that's the correct way to do it.
upvoted 0 times
...
Sanda
9 months ago
A) In module's etc/di.xml, define virtualType node to override argument and create a subclass of A. Then use type node to pass the subclass A object into class B.
upvoted 0 times
...
...
Joesph
10 months ago
Hmm, this seems straightforward. I think A is the correct answer, as it mentions using di.xml to override the argument and create a subclass of A, which can then be injected into class B.
upvoted 0 times
Linsey
10 months ago
Yes, using di.xml to override the argument and create a subclass of A is the standard approach.
upvoted 0 times
...
Goldie
10 months ago
I agree, option A is the correct way to do it.
upvoted 0 times
...
...
Ardella
11 months ago
I'm not sure, but after thinking about it, I also believe option A is the best choice. It follows the standard Magento practices for dependency injection.
upvoted 0 times
...
Erin
11 months ago
I agree with Rossana. Option A seems like the correct approach to override the argument of class A and inject it into class B without affecting class C.
upvoted 0 times
...
Rossana
11 months ago
I think the magento standard way to do this is option A.
upvoted 0 times
...

Save Cancel