How do you resolve the issue, keeping maintainability in mind?

Posted by: Pdfprep Category: AD0-E703 Tags: , ,

A custom module is performing an optimized custom query for quote items.

The class applies the query customizations on the select object of a quote item collection instance.

You are tasked to resolve an issue where the query sometimes does not deliver the expected results. You have debugged the problem and found another class is also using a quote item collection and is loading the collection before the custom module.

How do you resolve the issue, keeping maintainability in mind?
A . You change the argument type toMagentoQuoteModelResourceModelQuoteItemCollectionFactory and instantiate the collection using $collectionFactory->create();
B . You remove the constructor argument and use ObjectManager::getInstance()->create(MagentoQuoteModelResourceModelQuoteItemCollection::class) to instantiate the collection instead.
C . You inject MagentoFrameworkDBSelect instead of the collection and perform the desired query independently of the collection.
D . You inject MagentoQuoteApiCartItemRepositoryInterface because low level query customizations are not allowed.

Answer: A

Leave a Reply

Your email address will not be published.