You have injected \Magento\Framework\Api\SearchCriteria into the constructor method. You then wrote the following code in a method: 1: $search = $this->searchCriteria->setSortOrders([‘entity_id ASC’]); 2: $this->productRepository>getList($search); When running this code, you get an error: Fatal error: Uncaught TypeError: Argument 1 must be an instance of SortOrder, string given. What are two errors present in the examples given?

2.34K 浏览助理开发人员考试测试题库

You have injected \Magento\Framework\Api\SearchCriteria into the constructor method. You then wrote the following code in a method: 1: $search = $this->searchCriteria->setSortOrders([‘entity_id ASC’]); 2: $this->productRepository>getList($search); When running this code, you get an error: Fatal error: Uncaught TypeError: Argument 1 must be an instance of SortOrder, string given. What are two errors present in the examples given?

0