I used following code
->order(new \Zend_Db_Expr('FIELD(option_id,' . implode(',', $totalPro).')'));
That give following warning.
Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento 2.
How to remove this warning?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI used following code
->order(new \Zend_Db_Expr('FIELD(option_id,' . implode(',', $totalPro).')'));
That give following warning.
Direct object instantiation (object of \Zend_Db_Expr) is discouraged in Magento 2.
How to remove this warning?
->order(\Zend_Db_Expr('FIELD(option_id,' . implode(',', $totalPro).')'));
Magento doesn't usenew \Class\Name
instead of that they have implemented an object manager.Fatal error: Uncaught Error: Call to undefined function Zend_Db_Expr()
vendor/magento/module-review/Model/ResourceModel/Rating.php
Zend_Db_Expr
but got the same error on core file not allowed.